Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 262f661

Browse files
author
Alexandre Le Foll
authored
Fix separator in regex for Windows (#13)
1 parent d7e7b9c commit 262f661

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/processors/directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2021 Canva Inc. All Rights Reserved.
22

33
import * as camelcase from 'camelcase';
4-
import { escapeRegExp } from 'lodash';
4+
import escapeRegExp = require('lodash.escaperegexp');
55
import { OptionsV2, parseStringPromise as xml2js } from 'xml2js';
66
import { DependencyTree, FileToDeps, Path } from '../';
77
import { FileProcessor } from '../file_processor';

src/processors/feature.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { messages } from 'cucumber-messages';
44
import * as gherkin from 'gherkin';
5+
import escapeRegExp = require('lodash.escaperegexp');
56
import * as path from 'path';
67
import * as ts from 'typescript';
78
import { FileToDeps, Path } from '../';
@@ -16,8 +17,12 @@ const warn = logger.extend('warn');
1617

1718
const STORIES_IMPORT = 'storiesOf';
1819
const STORIES_PACKAGE = '@storybook/react';
19-
const STORIES_FILE_RE = new RegExp(`([^${path.sep}]+)\\.stories\\.tsx?$`);
20-
const STEPS_FILE_RE = new RegExp(`([^${path.sep}]+)\\.steps\\.ts$`);
20+
const STORIES_FILE_RE = new RegExp(
21+
`([^${escapeRegExp(path.sep)}]+)\\.stories\\.tsx?$`,
22+
);
23+
const STEPS_FILE_RE = new RegExp(
24+
`([^${escapeRegExp(path.sep)}]+)\\.steps\\.ts$`,
25+
);
2126
const RE_LITERAL_RE = /^\/(.+)\/([gimsuy]*)$/;
2227
const STEP_DEFININITION_FN_NAMES = ['When', 'Then', 'Given'];
2328

0 commit comments

Comments
 (0)