-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤷♂️ skipping actual git branch check, added NETLIFY_LOCAL_BRANCH whi…
…ch will be used for cli context override #1
- Loading branch information
Showing
3 changed files
with
12 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import { describe, it } from "mocha"; | ||
import * as assert from "assert"; | ||
|
||
import * as gitBranch from "git-branch"; | ||
|
||
import { parseNetlifyConfig, parseWebpackConfig } from "../../src/ts"; | ||
|
||
process.env.NETLIFY_LOCAL_BRANCH = "default" | ||
|
||
describe('Config', function() { | ||
describe('parseNetlifyConfig', function() { | ||
it('should throw when not found', function() { | ||
assert.throws(() => parseNetlifyConfig("test/toml/netlify.toml" + Math.random())); | ||
}); | ||
it('should override build with context', function() { | ||
const currentBranch = gitBranch.sync() || process.env.TRAVIS_BRANCH; | ||
const netlifyConfig = parseNetlifyConfig("test/toml/netlify-example-1.toml"); | ||
|
||
assert.equal(netlifyConfig.build.base, `${currentBranch}-base`); | ||
assert.equal(netlifyConfig.build.publish, `${currentBranch}-publish`); | ||
assert.equal(netlifyConfig.build.functions, `${currentBranch}-functions`); | ||
assert.equal(netlifyConfig.build.command, `${currentBranch}-command`); | ||
assert.equal(netlifyConfig.build.base, `default-base`); | ||
assert.equal(netlifyConfig.build.publish, `default-publish`); | ||
assert.equal(netlifyConfig.build.functions, `default-functions`); | ||
assert.equal(netlifyConfig.build.command, `default-command`); | ||
}); | ||
}); | ||
}); |