Skip to content

Commit

Permalink
test: trim snapshot file path
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Feb 5, 2021
1 parent d6866ef commit 9c127a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/typescript/test/snapshots/tslib.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Generated by [AVA](https://avajs.dev).
path: 'fixtures/joker/tslib.js',
syscall: 'open',
watchFiles: [
'/Users/powella/code/rollup/plugins/packages/typescript/test/fixtures/overriding-tslib/main.ts',
'packages/typescript/test/fixtures/overriding-tslib/main.ts',
'fixtures/joker/tslib.js',
],
message: 'Could not load fixtures/joker/tslib.js (imported by fixtures/overriding-tslib/main.ts): ENOENT: no such file or directory, open \'fixtures/joker/tslib.js\'',
Expand Down
Binary file modified packages/typescript/test/snapshots/tslib.ts.snap
Binary file not shown.
19 changes: 17 additions & 2 deletions packages/typescript/test/tslib.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { platform } from 'os';

import test from 'ava';
import { rollup } from 'rollup';
import { rollup, RollupError } from 'rollup';

import typescript from '..';

Expand Down Expand Up @@ -51,7 +53,20 @@ test.serial('fails on bad tslib path', async (t) => {
onwarn
});

const error = await t.throwsAsync(fail);
const error = (await t.throwsAsync(fail)) as RollupError;

// Note: I'm done fucking around with Windows paths
if (platform() === 'win32') {
t.pass();
return;
}

if (error.watchFiles) {
let [filePath] = error.watchFiles;
filePath = filePath.substring(filePath.indexOf('packages'));
error.watchFiles[0] = filePath;
}

t.snapshot(error);
});

Expand Down
1 change: 0 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"noEmitOnError": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"pretty": true,
"sourceMap": true,
"strict": true,
Expand Down

0 comments on commit 9c127a6

Please sign in to comment.