Skip to content

Commit

Permalink
add failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jul 11, 2017
1 parent df321cd commit 61eaf42
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 0 deletions.
11 changes: 11 additions & 0 deletions __tests__/commands/install/workspaces-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ test.concurrent('install should prioritize non workspace dependency at root over
});
});

test.concurrent('install should run local install scripts', (): Promise<void> => {
return runInstall({}, 'workspaces-install-scripts', async (config): Promise<void> => {
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'src.js'))).toBe(true);
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'prepublish.js'))).toBe(true);
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'prepublishOnly.js'))).toBe(true);
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'prepare.js'))).toBe(true);
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'preinstall.js'))).toBe(true);
expect(await fs.exists(path.join(config.cwd, 'node_modules', 'workspace-3', 'postinstall.js'))).toBe(true);
});
});

test.concurrent('install should install subedependencies of workspaces', (): Promise<void> => {
// the tricky part is that isarray is a subdependency of left-pad that is not referenced in the root
// but another workspace
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspaces-experimental true
10 changes: 10 additions & 0 deletions __tests__/fixtures/install/workspaces-install-scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "my-project",
"private": true,
"dependencies": {
"left-pad": "1.1.3"
},
"workspaces": [
"packages/*"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "workspace-2",
"version": "1.0.0",
"dependencies": {
"workspace-3": "1.0.0"
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "workspace-3",
"version": "1.0.0",
"scripts": {
"prepublish": "cpy src.js prepublish.js",
"prepublishOnly": "cpy src.js prepublishOnly.js",
"prepare": "cpy src.js prepare.js",
"preinstall": "cpy src.js preinstall.js",
"postinstall": "cpy src.js postinstall.js"
},
"dependencies": {
"repeat-string": "1.6.1"
}
}
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 61eaf42

Please sign in to comment.