sandersn / mini-typescript

A miniature model of the Typescript compiler, intended to teach the structure of the real Typescript compiler
MIT License
1.14k stars 61 forks source link

Test failure: missing baselines/local directory (ENOENT: no such file or directory) #7

Closed morzel85 closed 3 years ago

morzel85 commented 3 years ago

If there is a test failure on newly cloned repo, then an error happens due to missing baselines/local directory.

If empty baselines/local is added before npm test is run, then tests are handled properly (local files are created)...

Example (run on Ubuntu WSL):

xxx@yyy:~/projects/gh/sandersn/mini-typescript$ npm test

> mini-typescript@1.0.0 test
> rm baselines/local/*; tsc && node test.js

rm: cannot remove 'baselines/local/*': No such file or directory
node:internal/fs/utils:343
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'baselines/local/basicLex.lex.baseline'
    at Object.openSync (node:fs:582:3)
    at Object.writeFileSync (node:fs:2143:35)
    at test (/home/xxx/projects/gh/sandersn/mini-typescript/test.js:13:12)
    at /home/xxx/projects/gh/sandersn/mini-typescript/test.js:78:68
    at Array.map (<anonymous>)
    at Object.<anonymous> (/home/xxx/projects/gh/sandersn/mini-typescript/test.js:78:46)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'baselines/local/basicLex.lex.baseline'
}

Maybe the dir could be added as a postinstall step with mkdir -p baselines/local ?

sandersn commented 3 years ago

Fixed by #1