Atom Jasmine 3 Test Runner
raw JSON → 5.2.13 verified Fri May 01 auth: no javascript
Atom Jasmine 3 Test Runner (v5.2.13) lets you run Atom package tests with Jasmine 3.x instead of the default Jasmine 1.3. It provides a simple drop-in replacement via the atomTestRunner field in package.json, with options for custom runners and legacy spec support. Maintained by UziTech, with updates for dependency compatibility. Key differentiators: minimal configuration, TypeScript support via atom-ts-transpiler, and custom matchers/plugins.
Common errors
error Error: Cannot find module 'atom-jasmine3-test-runner' ↓
cause Missing npm install or incorrect path in atomTestRunner.
fix
Run
npm install --save-dev atom-jasmine3-test-runner and ensure package.json has the correct string. error TypeError: (0 , _atomJasmine3TestRunner.createRunner) is not a function ↓
cause Using ESM import syntax instead of CommonJS require.
fix
Replace
import { createRunner } from '...' with const { createRunner } = require('...'). error ReferenceError: jasmine is not defined ↓
cause Using jasmine globals outside of spec files or before Jasmine is loaded.
fix
Ensure configuration function is called after Jasmine is loaded; use inside spec files or the config callback.
error Error: Unrecognized token '...' (trying to parse .ts file) ↓
cause TypeScript specs without atom-ts-transpiler configured.
fix
Install atom-ts-transpiler and add 'atomTranspilers' to package.json.
Warnings
breaking Glob dependency updated to v8 (v5.2.12+). Path separators may behave differently on Windows. ↓
fix Ensure glob patterns use forward slashes or update path handling.
deprecated Legacy support for -spec-v1 files will be removed in future major versions. ↓
fix Migrate all specs to Jasmine 3 syntax and remove legacy suffix.
gotcha Atom's compile cache may cache package.json; changes to atomTestRunner may not take effect until restart. ↓
fix Restart Atom after modifying package.json.
gotcha TypeScript specs require atom-ts-transpiler; custom runner file must be .js, not .ts. ↓
fix Use atom-ts-transpiler and keep custom runner as .js.
breaking Jasmine version upgrades (e.g., 3.8 to 3.10) may introduce new behavior or deprecations. ↓
fix Review Jasmine changelogs for breaking changes between versions.
Install
npm install atom-jasmine3-test-runner yarn add atom-jasmine3-test-runner pnpm add atom-jasmine3-test-runner Imports
- createRunner wrong
import { createRunner } from 'atom-jasmine3-test-runner'correctconst { createRunner } = require('atom-jasmine3-test-runner') - default (runner) wrong
import runner from 'atom-jasmine3-test-runner'correctmodule.exports = require('atom-jasmine3-test-runner') - config function wrong
const runner = createRunner()correctconst { createRunner } = require('atom-jasmine3-test-runner'); const runner = createRunner({}, configFunction)
Quickstart
// In package.json:
// "atomTestRunner": "atom-jasmine3-test-runner"
// For custom runner:
// spec/custom-runner.js
const { createRunner } = require('atom-jasmine3-test-runner');
const extraOptions = {
suffix: '-spec',
legacySuffix: '-spec-v1'
};
const configFn = function() {
require('some-jasmine-plugin');
beforeEach(function() {
jasmine.addMatchers({
toBeTheAnswer: function(util) {
return {
compare: function(actual) {
const pass = util.equals(actual, 42);
return { pass, message: `Expected ${actual} ${pass ? 'not to be' : 'to be'} 42` };
}
};
}
});
});
};
const runner = createRunner(extraOptions, configFn);
module.exports = runner;