-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run cli, static, and dynamic tests on CI, add tests for cache busting
- Loading branch information
Showing
5 changed files
with
109 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.rs] | ||
indent_size = 4 | ||
|
||
[*.toml] | ||
indent_size = 4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,77 @@ | ||
import { expect } from 'chai'; | ||
import BuildSettings from '../../../../cli/lib/build-settings'; | ||
|
||
describe('build settings', () => { | ||
const env = { | ||
npm_config_target: null, | ||
npm_config_arch: null, | ||
npm_config_target_arch: null, | ||
npm_config_disturl: null, | ||
npm_config_runtime: null, | ||
npm_config_build_from_source: null, | ||
npm_config_devdir: null | ||
}; | ||
|
||
describe('match', () => { | ||
it('should not match build settings if nodeVersion is different', () => { | ||
const buildSettings = new BuildSettings('rustc-version', 'v11.8.0', env); | ||
const otherSettings = new BuildSettings('rustc-version', 'v10.8.0', env); | ||
expect(buildSettings.match(otherSettings)).equal(false); | ||
}); | ||
|
||
it('should match build settings if nodeVersion is same', () => { | ||
const buildSettings = new BuildSettings('rustc-version', 'v11.8.0', env); | ||
const otherSettings = new BuildSettings('rustc-version', 'v11.8.0', env); | ||
expect(buildSettings.match(otherSettings)).equal(true); | ||
}); | ||
|
||
it('should not match against current build settings when nodeVersion is null', () => { | ||
const buildSettings = BuildSettings.current(); | ||
const otherSettings = new BuildSettings('rustc-version', null, env); | ||
expect(buildSettings.match(otherSettings)).equal(false); | ||
}) | ||
}); | ||
|
||
describe('serialize', () => { | ||
it('should work when nodeVersion is null', () => { | ||
|
||
}) | ||
}) | ||
|
||
describe('current build settings', () => { | ||
it('should return values of expected types', () => { | ||
// @ts-ignore | ||
const { nodeVersion, env, rustc } = BuildSettings.current(); | ||
expect(nodeVersion).to.be.a('string'); | ||
expect(rustc).to.be.a('string'); | ||
expect(env).to.deep.equal({ | ||
npm_config_target: process.env.npm_config_target || null, | ||
npm_config_arch: process.env.npm_config_arch || null, | ||
npm_config_target_arch: process.env.npm_config_target_arch || null, | ||
npm_config_disturl: process.env.npm_config_disturl || null, | ||
npm_config_runtime: process.env.npm_config_runtime || null, | ||
npm_config_build_from_source: process.env.npm_config_build_from_source || null, | ||
npm_config_devdir: process.env.npm_config_devdir || null | ||
}); | ||
}); | ||
}); | ||
|
||
describe('get node version', () => { | ||
it('should return a string', () => { | ||
expect(BuildSettings.getNodeVersion()).to.be.a('string'); | ||
}); | ||
}); | ||
|
||
describe('serialize and deserialize', () => { | ||
it('should be equal when nodeVersion is null', () => { | ||
expect(JSON.stringify(BuildSettings.fromJSON({ | ||
rustc: 'rustc-version', | ||
env | ||
}))).equal(JSON.stringify(new BuildSettings( | ||
'rustc-version', | ||
null, | ||
env | ||
).toJSON())); | ||
}); | ||
}) | ||
}); |