Registry / testing / atom-grammar-test

atom-grammar-test

JSON →
library0.6.4jsnpmunverified

atom-grammar-test is a testing framework designed specifically for Atom editor grammar definitions, inspired by Sublime Text's syntax testing format. It allows developers to define grammar fixtures directly within source code comments, visually annotating how grammar rules should parse different code constructs. This enables both programmatic testing and visual inspection of grammar behavior. The current stable version is 0.6.4. Given that the Atom editor has been officially archived and is no longer maintained, this package is effectively abandoned, with no active development or release cadence. Its primary differentiator was its tight integration with the Atom ecosystem and its visual testing approach.

npm install atom-grammar-test
INSTALL
IMPORT
SIG · ATOM-GRAMMAR-TEST
A
atom-grammar-test
testingjavascriptv0.6.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grammarTest
const grammarTest = require('atom-grammar-test');
import grammarTest from 'atom-grammar-test';
This package primarily uses CommonJS `require` syntax, as it was designed for the Atom editor's environment, which often used CommonJS for package development.

Demonstrates how to integrate `atom-grammar-test` into an Atom package's Jasmine test suite to test a custom grammar definition.

const grammarTest = require('atom-grammar-test'); const path = require('path'); describe('My Custom Grammar', () => { beforeEach(() => { // Ensure your language package is loaded // In Atom, this is typically an asynchronous operation. // WaitsForPromise is an Atom-specific Jasmine helper. waitsForPromise(() => { // Replace 'language-my-grammar' with your actual Atom package name return atom.packages.activatePackage('language-c'); }); }); // Point to a grammar test file. This file would contain inline syntax assertions. // Example: 'test-fixtures/c-grammar-test.c' grammarTest(path.join(__dirname, 'test-fixtures', 'c-grammar-test.c')); // A dummy test file for illustration, replace with actual path: // You would create 'test-fixtures/c-grammar-test.c' with content like: /* // SYNTAX TEST "source.c" #pragma once // <- punctuation.definition.directive meta.preprocessor.c int main() { // <- storage.type // ^ meta.function entity.name.function return 0; // ^^^^^^ keyword.control } */ });
atom-grammar-test --version
Debug
Known issues
breakingThe Atom editor, which this package depends on, was officially archived by GitHub on December 15, 2022. This means atom-grammar-test is no longer functional in a supported environment.
fix
Migrate your grammar testing to a different editor platform (e.g., VS Code) and use a testing solution compatible with that platform.
affects: >=0.1.0
gotchaThis package is designed exclusively for testing Atom grammar packages and relies heavily on Atom's internal APIs and Jasmine 1.3 test runner. It cannot be used outside the Atom ecosystem.
fix
Ensure you are developing an Atom package and running tests within the Atom test environment. For other environments, a different testing tool is required.
affects: >=0.1.0
deprecatedThe package uses a CommonJS `require` pattern and does not provide ESM exports. While Atom's environment typically supported CommonJS, modern JavaScript development often favors ESM.
fix
No direct fix as the package is abandoned. If it were active, an update to include ESM exports would be necessary.
affects: <=0.6.4
Errors
Common errors & fixes
ReferenceError: atom is not defined
The test suite is being run outside of the Atom editor's test environment.
fix
Ensure your tests are executed using Atom's `atom --test` command or through its built-in test runner for packages.
TypeError: Cannot read property 'activatePackage' of undefined
The `atom.packages` object is not available, likely because Atom's environment hasn't fully loaded or the test runner isn't properly initialized.
fix
Verify that your `beforeEach` block properly waits for Atom's packages to activate using `waitsForPromise` (or equivalent asynchronous handling in a modern Jasmine setup) and that the test environment is correctly set up.
Upgrade
Version history
0.6.4latest on npm
Audit
Dependencies
atomrequiredRuntime dependency for the Atom editor environment, specifically requiring Atom >=1.0.0 <2.0.0. The package leverages Atom's built-in Jasmine 1.3 for testing.
Agent activity
27 hits · last 30 days
node
22
OpenAI (training)
1
Resources
atom-grammar-test — npm install atom-grammar-test · libregistry