Skip to content

Commit

Permalink
Enforce POSIX file paths
Browse files Browse the repository at this point in the history
Fixes #65
  • Loading branch information
jlmakes committed Mar 24, 2020
1 parent 097e1a4 commit 5668d68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## Unreleased

### Fixed

- File watcher works on Windows. [@spectras](https://github.com/spectras) [#65](https://github.com/jlmakes/karma-rollup-preprocessor/issues/65)

## [7.0.4] - 2020-03-22

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ function createWatcher(emitter) {
let files = new Map()
let watch = chokidar.watch()

const refreshFile = path => {
const refreshFile = filePath => {
/**
* Had to go diving for this one...
* not exactly Karma’s public facing API,
* but appears to get the job done =)
*/
emitter._fileList.changeFile(path, true)
let isPOSIX = path.sep === '/'
filePath = isPOSIX ? filePath : filePath.replace(/\\/g, '/')
emitter._fileList.changeFile(filePath, true)
}

const handleChange = path => {
Expand Down

0 comments on commit 5668d68

Please sign in to comment.