Skip to content

Commit fee2b18

Browse files
committed
test(inject): avoid obsolete win32 snapshot
1 parent 559affc commit fee2b18

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

packages/inject/test/snapshots/test.js.snap

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ $(() => {
99
"
1010
`;
1111

12-
exports[`escapes backslashes in module name 1`] = `
13-
"import { default as $ } from 'slash\\\\back';
14-
15-
$(() => {
16-
console.log('ready');
17-
});
18-
"
19-
`;
20-
2112
exports[`generates * imports 1`] = `
2213
"import * as foo from 'foo';
2314

packages/inject/test/test.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const acorn = require('acorn');
66

77
const inject = require('..');
88

9-
const compare = (fixture, options) => {
9+
const transform = (fixture, options) => {
1010
const filename = path.resolve(`test/fixtures/${fixture}/input.js`);
1111
const input = fs.readFileSync(filename, 'utf-8');
1212
const output = inject(options).transform.call(
@@ -21,7 +21,11 @@ const compare = (fixture, options) => {
2121
filename
2222
);
2323

24-
expect(output ? output.code : input).toMatchSnapshot();
24+
return output ? output.code : input;
25+
};
26+
27+
const compare = (fixture, options) => {
28+
expect(transform(fixture, options)).toMatchSnapshot();
2529
};
2630

2731
test('inserts a default import statement', () => {
@@ -43,7 +47,9 @@ if (os.platform() === 'win32') {
4347
// so it cannot appear within filename
4448
} else {
4549
test('escapes backslashes in module name', () => {
46-
compare('basic', { $: 'slash\\back' });
50+
expect(transform('basic', { $: 'slash\\back' })).toContain(
51+
"import { default as $ } from 'slash\\\\back';"
52+
);
4753
});
4854
}
4955

0 commit comments

Comments
 (0)