Skip to content

Commit 77cc1fe

Browse files
committed
Fix annotation path
1 parent 689cb49 commit 77cc1fe

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

Gruntfile.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ module.exports = (grunt) => {
2929
},
3030

3131
postcss: {
32+
mapAnnotationPath: {
33+
options: {
34+
map: {
35+
inline: false,
36+
annotation: 'tmp/maps/'
37+
},
38+
processors: processors
39+
},
40+
src: 'test/fixtures/a.css',
41+
dest: 'tmp/mapAnnotationPath.css'
42+
},
3243
defaults: {
3344
options: {
3445
processors: processors
@@ -61,17 +72,6 @@ module.exports = (grunt) => {
6172
src: 'test/fixtures/a.css',
6273
dest: 'tmp/mapSeparate.css'
6374
},
64-
mapAnnotationPath: {
65-
options: {
66-
map: {
67-
inline: false,
68-
annotation: '/tmp/maps/'
69-
},
70-
processors: processors
71-
},
72-
src: 'test/fixtures/a.css',
73-
dest: 'tmp/mapAnnotationPath.css'
74-
},
7575
diff: {
7676
options: {
7777
diff: true,

test/test.js

+27-26
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,33 @@ const fileExists = async(file) => {
2525
try {
2626
await access(file);
2727
return true;
28-
} catch (err) {
28+
} catch (error) {
29+
console.log(error);
2930
return false;
3031
}
3132
};
3233

3334
exports.gruntPostcss = {
3435

36+
mapAnnotationPath: async(test) => {
37+
const actual = {
38+
css: await readFile('tmp/mapAnnotationPath.css', 'utf8'),
39+
map: await readFile('tmp/maps/mapAnnotationPath.css.map', 'utf8'),
40+
};
41+
42+
const expected = {
43+
css: await readFile('test/expected/mapAnnotationPath.css', 'utf8'),
44+
map: await readFile('test/expected/maps/mapAnnotationPath.css.map', 'utf8'),
45+
};
46+
47+
test.strictEqual(actual.css, expected.css);
48+
test.strictEqual(actual.map, expected.map);
49+
50+
const checkExists = await fileExists('tmp/mapAnnotationPath.css.map');
51+
test.ok(!checkExists);
52+
test.done();
53+
},
54+
3555
defaults: async(test) => {
3656
const actual = {
3757
css: await readFile('tmp/defaults.css', 'utf8'),
@@ -41,9 +61,9 @@ exports.gruntPostcss = {
4161
css: await readFile('test/expected/defaults.css', 'utf8'),
4262
};
4363

44-
const checkExists = await fileExists('tmp/defaults.css.map');
45-
4664
test.strictEqual(actual.css, expected.css);
65+
66+
const checkExists = await fileExists('tmp/defaults.css.map');
4767
test.ok(!checkExists);
4868
test.done();
4969
},
@@ -57,9 +77,9 @@ exports.gruntPostcss = {
5777
css: await readFile('test/expected/defaults.css', 'utf8'),
5878
};
5979

60-
const checkExists = await fileExists('tmp/defaultsFn.css.map');
61-
6280
test.strictEqual(actual.css, expected.css);
81+
82+
const checkExists = await fileExists('tmp/defaultsFn.css.map');
6383
test.ok(!checkExists);
6484
test.done();
6585
},
@@ -73,9 +93,9 @@ exports.gruntPostcss = {
7393
css: await readFile('test/expected/mapInline.css', 'utf8'),
7494
};
7595

76-
const checkExists = await fileExists('tmp/mapInline.css.map');
77-
7896
test.strictEqual(actual.css, expected.css);
97+
98+
const checkExists = await fileExists('tmp/mapInline.css.map');
7999
test.ok(!checkExists);
80100
test.done();
81101
},
@@ -96,25 +116,6 @@ exports.gruntPostcss = {
96116
test.done();
97117
},
98118

99-
mapAnnotationPath: async(test) => {
100-
const actual = {
101-
css: await readFile('tmp/mapAnnotationPath.css', 'utf8'),
102-
map: await readFile('tmp/maps/mapAnnotationPath.css.map', 'utf8'),
103-
};
104-
105-
const expected = {
106-
css: await readFile('test/expected/mapAnnotationPath.css', 'utf8'),
107-
map: await readFile('test/expected/maps/mapAnnotationPath.css.map', 'utf8'),
108-
};
109-
110-
const checkExists = await fileExists('tmp/mapAnnotationPath.css.map');
111-
112-
test.strictEqual(actual.css, expected.css);
113-
test.strictEqual(actual.map, expected.map);
114-
test.ok(!checkExists);
115-
test.done();
116-
},
117-
118119
diff: async(test) => {
119120
const actual = {
120121
css: await readFile('tmp/diff.css', 'utf8'),

0 commit comments

Comments
 (0)