Skip to content

Commit 12f711a

Browse files
soldairalexeagle
authored andcommitted
fix: add missing async test fixes
1 parent 9a02ee0 commit 12f711a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

internal/linker/link_node_modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function symlink(target: string, path: string) {
3131
try{
3232
await fs.promises.symlink(target, path, 'junction');
3333
} catch(e){
34-
if(e.code !== 'ENOENT'){
34+
if(e.code !== 'EEXIST'){
3535
throw e;
3636
}
3737
// We assume here that the path is already linked to the correct target.

internal/linker/test/link_node_modules.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ describe('link_node_modules', () => {
3131
mkdirp(workspace);
3232
});
3333

34-
it('should report when modules manifest absent', () => {
34+
it('should report when modules manifest absent',async () => {
3535
try {
36-
(linker as any).main();
36+
await (linker as any).main();
3737
} catch (expected) {
3838
expect(expected.message).toContain('requires one argument');
3939
}
4040
try {
41-
(linker as any).main([]);
41+
await (linker as any).main([]);
4242
} catch (expected) {
4343
expect(expected.message).toContain('requires one argument');
4444
}
4545
try {
46-
(linker as any).main(['bad_path']);
46+
await (linker as any).main(['bad_path']);
4747
} catch (expected) {
4848
expect(expected.message).toContain('ENOENT');
4949
}
5050
});
5151

52-
it('should handle first-party packages in workspace', () => {
52+
it('should handle first-party packages in workspace', async() => {
5353
// Set the cwd() like Bazel would in the execroot
5454
process.chdir(workspace);
5555

@@ -62,15 +62,15 @@ describe('link_node_modules', () => {
6262
'workspace': workspace,
6363
});
6464

65-
linker.main(['manifest.json'], {dir: process.env['RUNFILES_DIR']} as any);
65+
await linker.main(['manifest.json'], {dir: process.env['RUNFILES_DIR']} as any);
6666

6767
// The linker expects to run as its own process, so it changes the wd
6868
process.chdir(path.join());
6969
expect(fs.readdirSync(path.join(process.env['TEST_TMPDIR']!, workspace, 'node_modules', 'a')))
7070
.toContain('index.js');
7171
});
7272

73-
it('should handle third-party packages in runfiles', () => {
73+
it('should handle third-party packages in runfiles', async () => {
7474
mkdirp('npm/node_modules/some-package');
7575
const idx = 'npm/node_modules/some-package/index.js';
7676
fs.writeFileSync(idx, 'exports = {}', 'utf-8');
@@ -82,7 +82,7 @@ describe('link_node_modules', () => {
8282
writeManifest({'root': 'npm/node_modules'});
8383
writeRunfiles(runfilesManifest);
8484

85-
linker.main(['manifest.json'], new linker.Runfiles());
85+
await linker.main(['manifest.json'], new linker.Runfiles());
8686

8787
// The linker expects to run as its own process, so it changes the wd
8888
process.chdir(path.join(process.env['TEST_TMPDIR']!, workspace));

0 commit comments

Comments
 (0)