Skip to content

Commit

Permalink
Added VS Code debugging configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Anantachai Saothong (Manta) committed Apr 27, 2017
1 parent 9bf9fc1 commit 0ada333
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Test",
"program": "${workspaceRoot}\\test\\runner.js"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Port",
"address": "localhost",
"port": 5858
}
]
}
20 changes: 17 additions & 3 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ filesAndDirectories.filter(directoriesOnly).forEach(directory => {
formattingOptions = require('../' + optionFilePath)
}

describe(pt.basename(directory), () => {
it('', () => {
const testSpecName = pt.basename(directory)
describe(testSpecName, () => {
it('can be formatted', () => {
if (fs.existsSync(actualFilePath)) fs.unlinkSync(actualFilePath)
if (fs.existsSync(debuggingFilePath)) fs.unlinkSync(debuggingFilePath)

Expand All @@ -55,7 +56,7 @@ filesAndDirectories.filter(directoriesOnly).forEach(directory => {
fs.writeFileSync(actualFilePath, actualContent)

try {
const tree = new Stylus.Parser(modifiedContent).parse()
const tree = new Stylus.Parser(inputContent).parse()
fs.writeFileSync(debuggingFilePath, JSON.stringify(tree, null, '\t'))
} catch (ex) {
// Do nothing
Expand Down Expand Up @@ -104,6 +105,19 @@ filesAndDirectories.filter(directoriesOnly).forEach(directory => {
})
}
})

// Skip output parsing for partial content
if (testSpecName.includes('option-wrap-mode')) {
return null
}

it('can be re-parsed', () => {
try {
new Stylus.Parser(outputContent).parse()
} catch (ex) {
fail(ex)
}
})
})
})

Expand Down

0 comments on commit 0ada333

Please sign in to comment.