-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dev dep request missing 'invalidateOnCreate'
Fixes #8375 Ported from Atlaspack: atlassian-labs/atlaspack#185 Co-authored-by: Pedro Yamada <tacla.yamada@gmail.com>
- Loading branch information
1 parent
b50bc79
commit d6a4df3
Showing
8 changed files
with
123 additions
and
18 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
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
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
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
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,62 @@ | ||
// @flow strict-local | ||
|
||
// eslint-disable-next-line @parcel/no-self-package-imports | ||
import {clearBuildCaches} from '@parcel/core/src/buildCache'; | ||
import {resolveDevDepRequestRef} from '../../src/requests/DevDepRequest'; | ||
import type {DevDepRequest, DevDepRequestRef} from '../../src/types'; | ||
import {toProjectPath} from '../../src/projectPath'; | ||
import assert from 'assert'; | ||
|
||
describe('DevDepRequest', () => { | ||
beforeEach(() => { | ||
clearBuildCaches(); | ||
}); | ||
|
||
describe('resolveDevDepRequestRef', () => { | ||
it('will return requests as is', () => { | ||
const request: DevDepRequest = { | ||
specifier: 'test', | ||
hash: 'hash', | ||
invalidateOnFileChange: new Set(), | ||
invalidateOnFileCreate: [], | ||
invalidateOnStartup: false, | ||
resolveFrom: toProjectPath('', 'path.js'), | ||
}; | ||
const result = resolveDevDepRequestRef(request); | ||
assert.equal(result, request); | ||
}); | ||
|
||
it('will return cached requests for refs', () => { | ||
const request: DevDepRequest = { | ||
specifier: 'test', | ||
hash: 'hash', | ||
invalidateOnFileChange: new Set(), | ||
invalidateOnFileCreate: [], | ||
invalidateOnStartup: false, | ||
resolveFrom: toProjectPath('', 'path.js'), | ||
}; | ||
resolveDevDepRequestRef(request); | ||
|
||
const devDepRequestRef: DevDepRequestRef = { | ||
type: 'ref', | ||
specifier: 'test', | ||
hash: 'hash', | ||
resolveFrom: toProjectPath('', 'path.js'), | ||
}; | ||
const result = resolveDevDepRequestRef(devDepRequestRef); | ||
assert.equal(result, request); | ||
}); | ||
|
||
it('will throw for uncached refs', () => { | ||
const devDepRequestRef: DevDepRequestRef = { | ||
type: 'ref', | ||
specifier: 'test', | ||
hash: 'hash', | ||
resolveFrom: toProjectPath('', 'path.js'), | ||
}; | ||
assert.throws(() => { | ||
resolveDevDepRequestRef(devDepRequestRef); | ||
}); | ||
}); | ||
}); | ||
}); |