-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(build): Remove moduleId from components when building (#3664)
Fixes #3576
- Loading branch information
Showing
3 changed files
with
61 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
// This needs to be first so fs module can be mocked correctly. | ||
import { expect } from 'chai'; | ||
|
||
import { removeModuleIdOnlyForTesting } from '../../packages/@ngtools/webpack/src/loader'; | ||
|
||
describe('@ngtools webpack loader: ', () => { | ||
describe('removeModuleId', () => { | ||
let refactor: any; | ||
let moduleIdProp: any; | ||
let commaProp: any; | ||
let removeNodesArgs: any; | ||
beforeEach(() => { | ||
commaProp = { isCommaProp: true }; | ||
moduleIdProp = { | ||
name: { getText: () => 'moduleId' }, | ||
parent: { getChildAt: () => ({ getChildren: (): any => [{}, commaProp] }) } | ||
}; | ||
refactor = { | ||
sourceFile: 'sourceFile', | ||
findAstNodes: (): any => [{ properties: [moduleIdProp] }], | ||
removeNodes: (...args: any[]) => { removeNodesArgs = args; } | ||
}; | ||
}); | ||
|
||
it('should remove "moduleId: module.id"', () => { | ||
removeModuleIdOnlyForTesting(refactor); | ||
expect(removeNodesArgs[0]).to.equal(moduleIdProp); | ||
expect(removeNodesArgs[1]).to.equal(commaProp); | ||
}); | ||
}); | ||
}); |