-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -810,3 +810,29 @@ test.concurrent('warns when peer dependency is incorrect during add', (): Promis | |
'add-with-peer-dependency-incorrect', | ||
); | ||
}); | ||
|
||
test.concurrent('should retain build artifacts after add', (): Promise<void> => { | ||
return buildRun( | ||
reporters.BufferReporter, | ||
fixturesLoc, | ||
async (args, flags, config, reporter, lockfile): Promise<void> => { | ||
const addA = new Add(args, flags, config, reporter, lockfile); | ||
await addA.init(); | ||
|
||
const expectedArtifacts = ['foo.txt']; | ||
const integrityLoc = path.join(config.cwd, 'node_modules', constants.INTEGRITY_FILENAME); | ||
|
||
const beforeIntegrity = await fs.readJson(integrityLoc); | ||
expect(beforeIntegrity.artifacts['[email protected]']).toEqual(expectedArtifacts); | ||
|
||
const addB = new Add(['file:b'], flags, config, reporter, lockfile); | ||
await addB.init(); | ||
|
||
const afterIntegrity = await fs.readJson(integrityLoc); | ||
expect(afterIntegrity.artifacts['[email protected]']).toEqual(expectedArtifacts); | ||
}, | ||
['file:a'], | ||
{}, | ||
'retain-build-artifacts-after-add', | ||
); | ||
}); |
1 change: 1 addition & 0 deletions
1
__tests__/fixtures/add/retain-build-artifacts-after-add/a/install.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require('fs').writeFileSync('foo.txt', 'foobar'); |
7 changes: 7 additions & 0 deletions
7
__tests__/fixtures/add/retain-build-artifacts-after-add/a/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "a", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"postinstall": "node install.js" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__tests__/fixtures/add/retain-build-artifacts-after-add/b/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "b", | ||
"version": "0.0.0" | ||
} |
1 change: 1 addition & 0 deletions
1
__tests__/fixtures/add/retain-build-artifacts-after-add/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters