-
-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue where vsc config and local were merged. Closes #1074
- Loading branch information
Showing
12 changed files
with
111 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,45 @@ | ||
import * as assert from "assert"; | ||
import { format } from "./format.test"; | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
import { format, getText } from "./format.test"; | ||
|
||
const standardResult = `function foo() { | ||
console.log("test"); | ||
} | ||
`; | ||
|
||
const vscodeResult = `function foo() { | ||
const foo = [ | ||
"aaaaaaaaa", | ||
"bbbbbb", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
]; | ||
} | ||
`; | ||
|
||
const testConfig = (filePath: string, expected: string = standardResult) => { | ||
const testConfig = (testPath: string, resultPath: string) => { | ||
return async () => { | ||
const { result } = await format("config", filePath); | ||
const { result } = await format("config", testPath); | ||
const expected = await getText("config", resultPath); | ||
assert.equal(result, expected); | ||
}; | ||
}; | ||
|
||
const prettierConfigOrig = path.resolve(__dirname, "../../../.prettierrc"); | ||
const prettierConfigTemp = path.resolve(__dirname, "../../../old.prettierrc"); | ||
|
||
suite("Test configurations", function() { | ||
this.timeout(10000); | ||
test("it uses config from .prettierrc file ", testConfig("rcfile/test.js")); | ||
this.beforeAll(cb => { | ||
fs.rename(prettierConfigOrig, prettierConfigTemp, cb); | ||
}); | ||
this.afterAll(cb => { | ||
fs.rename(prettierConfigTemp, prettierConfigOrig, cb); | ||
}); | ||
test( | ||
"it uses config from .prettierrc file and does not inherit VS Code settings ", | ||
testConfig("rcfile/test.js", "rcfile/test.result.js") | ||
); | ||
test( | ||
"it uses config from prettier.config.js file ", | ||
testConfig("jsconfigfile/test.js") | ||
testConfig("jsconfigfile/test.js", "jsconfigfile/test.result.js") | ||
); | ||
test( | ||
"it uses config from .prettierrc.js file ", | ||
testConfig("jsfile/test.js") | ||
testConfig("jsfile/test.js", "jsfile/test.result.js") | ||
); | ||
test( | ||
"it uses config from .editorconfig file ", | ||
testConfig("editorconfig/test.js") | ||
testConfig("editorconfig/test.js", "editorconfig/test.result.js") | ||
); | ||
test( | ||
"it uses config from vscode settings ", | ||
testConfig("vscodeconfig/test.js", vscodeResult) | ||
testConfig("vscodeconfig/test.js", "vscodeconfig/test.result.js") | ||
); | ||
}); |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function foo() { | ||
console.log("test"); | ||
} |
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,3 @@ | ||
function foo() { | ||
console.log("test"); | ||
} |
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,3 +1,7 @@ | ||
function foo() { | ||
console.log("test"); | ||
} | ||
const foo = ["aaaaaaaaa", "bbbbbb", | ||
"c","a", "b", | ||
"c","a", "b", | ||
"c","a", "b", | ||
"c"] | ||
} |
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,16 @@ | ||
function foo() { | ||
const foo = [ | ||
"aaaaaaaaa", | ||
"bbbbbb", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c" | ||
]; | ||
} |
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,3 @@ | ||
function foo() { | ||
console.log("test"); | ||
} |
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,16 @@ | ||
function foo() { | ||
const foo = [ | ||
"aaaaaaaaa", | ||
"bbbbbb", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
"a", | ||
"b", | ||
"c", | ||
]; | ||
} |