Skip to content

Commit

Permalink
Migrate test suite to AVA
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber623 committed Oct 15, 2023
1 parent aa97a36 commit 8ed061d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 53 deletions.
39 changes: 0 additions & 39 deletions spec/indexSpec.js

This file was deleted.

14 changes: 0 additions & 14 deletions spec/support/jasmine.json

This file was deleted.

File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const fs = require('node:fs');
const stylelint = require('stylelint');
const test = require('ava');

const config = require('../index');

test('module.exports', t => {
t.like(config, {
extends: ['stylelint-config-standard', 'stylelint-stylistic/config'],
plugins: ['stylelint-order']
});
});

test('loads configuration and validates correct syntax', async t => {
const code = fs.readFileSync('./test/helpers/valid.css', 'utf8');
const { errored } = await stylelint.lint({ code, config });

t.false(errored);
});

test('loads configuration and invalidates incorrect syntax', async t => {
const code = fs.readFileSync('./test/helpers/invalid.css', 'utf8');
const { errored, results } = await stylelint.lint({ code, config });

t.true(errored);

t.like(results, [
{
errored: true,
warnings: [
{ rule: 'order/properties-alphabetical-order' },
{ rule: 'stylistic/linebreaks' },
{ rule: 'stylistic/block-closing-brace-newline-before' },
{ rule: 'stylistic/block-opening-brace-newline-after' },
{ rule: 'stylistic/declaration-block-semicolon-newline-after' },
{ rule: 'stylistic/declaration-block-semicolon-space-before' },
{ rule: 'stylistic/declaration-block-trailing-semicolon' },
{ rule: 'stylistic/no-missing-end-of-source-newline' }
]
}
]);
});

0 comments on commit 8ed061d

Please sign in to comment.