Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
Add support for -spec files (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
lourenci committed Oct 27, 2018
1 parent 3f17d3f commit 7cebf28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function activate (context) {
const filenameWithoutExtension = openedFile[3]
const filenameExtension = openedFile[4]

const isSpecFile = /(\.|_)(spec|test)\./
const isSpecFile = /(\.|_|-)(spec|test)\./
if (!isSpecFile.test(openedFile)) {
const sufixSpecs = ['.spec', '.test', '_spec', '_test']
const sufixSpecs = ['.spec', '.test', '_spec', '_test', '-spec', '-test']

const sufixToOpen = sufixSpecs.map(spec => `${path}${filenameWithoutExtension}${spec}${filenameExtension}`)
.filter(spec => fs.existsSync(spec))
Expand All @@ -44,7 +44,7 @@ function activate (context) {
})
}
} else {
const sufixSpecs = ['.spec', '.test', '_spec', '_test']
const sufixSpecs = ['.spec', '.test', '_spec', '_test', '-spec', '-test']
let fileToOpen = openedFilename
sufixSpecs.forEach(spec => { fileToOpen = fileToOpen.replace(spec, '') })
if (fs.existsSync(fileToOpen)) {
Expand Down

0 comments on commit 7cebf28

Please sign in to comment.