-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: make mocha self-contained with the source map support #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
| #!/usr/bin/env node | ||
| // Copyright IBM Corp. 2017,2018. All Rights Reserved. | ||
| // Node module: @loopback/build | ||
| // This file is licensed under the MIT License. | ||
| // License text available at https://opensource.org/licenses/MIT | ||
|
|
||
| /* | ||
| ======== | ||
|
|
||
| Usage: | ||
| node ./bin/run-mocha | ||
|
|
||
| ======== | ||
| */ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| function run(argv, dryRun) { | ||
| const utils = require('./utils'); | ||
| const path = require('path'); | ||
|
|
||
| // Substitute the DIST variable with the dist folder | ||
| const dist = utils.getDistribution(); | ||
| const mochaOpts = argv.slice(2).map(a => a.replace(/\bDIST\b/g, dist)); | ||
|
|
||
| // Add default options | ||
| if (mochaOpts.indexOf('--opts') === -1) { | ||
| const optsPath = require.resolve('../mocha.opts'); | ||
| mochaOpts.unshift('--opts', optsPath); | ||
| } | ||
|
|
||
| // Add source map support | ||
| if (mochaOpts.indexOf('source-map-support/register') === -1) { | ||
| // Resolve source-map-support so that the path can be used by mocha | ||
| const sourceMapRegisterPath = require.resolve( | ||
| 'source-map-support/register' | ||
| ); | ||
| mochaOpts.unshift('--require', sourceMapRegisterPath); | ||
| } | ||
| const args = [...mochaOpts]; | ||
|
|
||
| return utils.runCLI('mocha/bin/mocha', args, dryRun); | ||
| } | ||
|
|
||
| module.exports = run; | ||
| if (require.main === module) run(process.argv); | ||
This file contains hidden or 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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -592,6 +592,8 @@ describe('Inspector for design time metadata', () => { | |
|
|
||
| @propertyDecorator() myArray: string[]; | ||
|
|
||
| @propertyDecorator() myUnionType: string | number; | ||
|
|
||
| @methodDecorator() | ||
| myMethod(x: string, y: number): boolean { | ||
| return false; | ||
|
|
@@ -631,6 +633,15 @@ describe('Inspector for design time metadata', () => { | |
| expect(meta).to.eql(MyClass); | ||
| }); | ||
|
|
||
| it('inspects design time type for properties with union type', () => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like unrelated changes to me. @raymondfeng could you please check these changes were intended? |
||
| const meta = MetadataInspector.getDesignTypeForProperty( | ||
| MyController.prototype, | ||
| 'myUnionType', | ||
| ); | ||
| // Union type is recorded as Object | ||
| expect(meta).to.eql(Object); | ||
| }); | ||
|
|
||
| it('inspects design time type for static properties', () => { | ||
| const meta = MetadataInspector.getDesignTypeForProperty( | ||
| MyController, | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this has effectively inlined
select-distscript, I think we can removeselect-distentirely? Just make sure to mention that removal in the commit message as a BREAKING CHANGE.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to leave
lb-distthere to keep backward compatibility as projects generated from previous versions of our CLI referencelb-dist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
To me, this is another argument against using
.alpha.Xprereleases for so long. If we were versioning non-core modules as0.x.y, then we could treat semver-patch release as backwards compatible and semver-minor releases as breaking. This works great with the carrot operator as implemented by npm's semver (https://www.npmjs.com/package/semver#caret-ranges-123-025-004):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the versioning. Is it too late to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I don't know. Let's open a new issue and try to find out what the implications of such change would be & how much work this change would require:
#954