You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- add a file to `errors` with a syntax error in it
- apparently this does throw syntax err, but does not cause `emitSkipped: true`... odd...
- so may need another test for that...
- `abortOnError: false` / `check: false` both cause Rollup to error out instead
- rename `errors/index` -> `errors/semantic` since we have different kinds now
- change the `include` to only take a single file, so that we don't unnecessarily generate declarations or type-check other error files
- refactor(test): rewrite `genBundle` in both files to take a relative path to a file
- simplifies the `emitDeclarationOnly` test as we can now just reuse the local `genBundle` instead of calling `helpers.genBundle` directly
- use the same structure for `errors`'s different files as well
- add a slightly hacky workaround to get `fs.remove` to not error
- seems to be a race condition due to the thrown errors and file handles not being closed immediately on throw (seems like they close during garbage collection instead?)
- see linked issue in the comment; workaround is to just give it some more time
- not sure that there is a true fix for this, since an improper close may cause indeterminate behavior
constcacheRoot=local("__temp/errors/rpt2-cache");// don't use the one in node_modules
14
14
constonwarn=jest.fn();
15
15
16
-
afterAll(()=>fs.remove(cacheRoot));
16
+
afterAll(async()=>{
17
+
// workaround: there seems to be some race condition causing fs.remove to fail, so give it a sec first (c.f. https://github.com/jprichardson/node-fs-extra/issues/532)
extraOpts: {include: [input], ...extraOpts},// only include the input itself, not other error files (to only generate types and type-check the one file)
24
29
onwarn,
25
30
});
26
31
}
27
32
28
-
test("integration - errors",async()=>{
33
+
test("integration - tsconfig errors",async()=>{
29
34
// TODO: move to parse-tsconfig unit tests?
30
-
expect(genBundle({
31
-
tsconfig: 'non-existent-tsconfig',
35
+
expect(genBundle("semantic.ts",{
36
+
tsconfig: "non-existent-tsconfig",
32
37
})).rejects.toThrow("rpt2: failed to open 'undefined'");// FIXME: bug: this should be "non-existent-tsconfig", not "undefined"
38
+
});
33
39
34
-
expect(genBundle()).rejects.toThrow(`semantic error TS2322: ${red("Type 'string' is not assignable to type 'number'.")}`);
40
+
test("integration - semantic error",async()=>{
41
+
expect(genBundle("semantic.ts")).rejects.toThrow(`semantic error TS2322: ${red("Type 'string' is not assignable to type 'number'.")}`);
0 commit comments