@americanexpress/one-app-locale-bundler
Advanced tools
Comparing version 6.5.7 to 6.5.8
@@ -19,2 +19,4 @@ /* | ||
jest.useFakeTimers(); | ||
jest.mock('chokidar', () => { | ||
@@ -32,2 +34,3 @@ const mockChokidar = { | ||
jest.spyOn(process, 'cwd').mockImplementation(() => 'module/path'); | ||
const consoleLogSpy = jest.spyOn(console, 'log'); | ||
@@ -61,2 +64,19 @@ beforeEach(() => jest.clearAllMocks()); | ||
}); | ||
it('throws on initial error', async () => { | ||
compileModuleLocales.mockRejectedValueOnce(new SyntaxError('some error')); | ||
await expect(async () => { | ||
await index(); | ||
jest.runAllTimers(); | ||
}).rejects.toThrowError(new SyntaxError('some error')); | ||
}); | ||
it('logs to console on error during watch', async () => { | ||
index(true); | ||
compileModuleLocales.mockRejectedValueOnce(new SyntaxError('some error')); | ||
await chokidar.on.mock.calls[0][1](); | ||
jest.runAllTimers(); | ||
expect(consoleLogSpy).toHaveBeenCalledTimes(1); | ||
expect(consoleLogSpy).toHaveBeenCalledWith('Error generating language packs: SyntaxError: some error'); | ||
}); | ||
}); |
@@ -17,3 +17,2 @@ /* | ||
// eslint-disable-next-line import/no-extraneous-dependencies -- erroneously thinks this is a dep, but we're in a test | ||
const mockFs = require('mock-fs'); | ||
@@ -20,0 +19,0 @@ |
@@ -6,2 +6,13 @@ # Change Log | ||
## [6.5.8](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-locale-bundler@6.5.7...@americanexpress/one-app-locale-bundler@6.5.8) (2023-04-07) | ||
### Bug Fixes | ||
* **locale-bundler:** do not exit on errors during watch ([#511](https://github.com/americanexpress/one-app-cli/issues/511)) ([f0fd6f8](https://github.com/americanexpress/one-app-cli/commit/f0fd6f8da23a6f7b9e2e1973aea559e5b53b4c1e)) | ||
## [6.5.7](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-locale-bundler@6.5.3...@americanexpress/one-app-locale-bundler@6.5.7) (2023-03-08) | ||
@@ -8,0 +19,0 @@ |
10
index.js
@@ -22,3 +22,2 @@ /* | ||
.catch((err) => { | ||
/* istanbul ignore next */ | ||
setTimeout(() => { throw err; }); | ||
@@ -28,2 +27,9 @@ }); | ||
function runLocaleBundlerLogErrors(modulePath) { | ||
return compileModuleLocales(modulePath) | ||
.catch((err) => { | ||
console.log(`Error generating language packs: ${err}`); | ||
}); | ||
} | ||
module.exports = function localeBundler(watch) { | ||
@@ -38,4 +44,4 @@ const modulePath = process.cwd(); | ||
.watch(inputPath, { ignoreInitial: true }) | ||
.on('all', () => runLocaleBundler(modulePath)); | ||
.on('all', () => runLocaleBundlerLogErrors(modulePath)); | ||
} | ||
}; |
{ | ||
"name": "@americanexpress/one-app-locale-bundler", | ||
"version": "6.5.7", | ||
"version": "6.5.8", | ||
"description": "A command line interface(CLI) tool for bundling the locale files.", | ||
@@ -55,2 +55,3 @@ "bin": { | ||
"mkdirp": "^0.5.1", | ||
"mock-fs": "^5.1.1", | ||
"rimraf": "^3.0.2" | ||
@@ -61,3 +62,3 @@ }, | ||
}, | ||
"gitHead": "d1ceff145f5fbc64190cc5fec1792120975cb487" | ||
"gitHead": "8c0493a903de6b49d5304f4993372c31fc213a8a" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41179
614
6
+ Addedmock-fs@^5.1.1
+ Addedmock-fs@5.4.1(transitive)