This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Work around inconsistent handling of strict directive
- Loading branch information
Jan Krems
committed
Mar 14, 2017
1 parent
2b93173
commit b4d5ee2
Showing
10 changed files
with
34 additions
and
11 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
'use strict'; | ||
let x = 0; | ||
function heartbeat() { | ||
++x; | ||
|
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,4 +1,3 @@ | ||
'use strict'; | ||
const { exports: moduleScoped } = module; | ||
|
||
function topFn(a, b = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
'use strict'; | ||
const { add } = require('./other'); | ||
|
||
const sum = add(40, 2); | ||
|
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,4 +1,3 @@ | ||
'use strict'; | ||
exports.add = function add(a, b) { | ||
return a + b; | ||
}; |
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,4 +1,3 @@ | ||
'use strict'; | ||
let error = null; | ||
try { | ||
throw new Error('Caught'); | ||
|
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,4 +1,3 @@ | ||
'use strict'; | ||
let x = 1; | ||
x = x + 1; | ||
module.exports = x; |
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,2 @@ | ||
'use strict'; | ||
console.log('first real line'); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
const Path = require('path'); | ||
|
||
const { test } = require('tap'); | ||
|
||
const startCLI = require('./start-cli'); | ||
|
||
test('for whiles that starts with strict directive', (t) => { | ||
const script = Path.join('examples', 'use-strict.js'); | ||
const cli = startCLI([script]); | ||
|
||
function onFatal(error) { | ||
cli.quit(); | ||
throw error; | ||
} | ||
|
||
return cli.waitFor(/break/) | ||
.then(() => cli.waitForPrompt()) | ||
.then(() => { | ||
t.match( | ||
cli.output, | ||
/break in [^:]+:(?:1|2)[^\d]/, | ||
'pauses either on strict directive or first "real" line'); | ||
}) | ||
.then(() => cli.quit()) | ||
.then(null, onFatal); | ||
}); |