UNPKG

sass-true

Version:

Unit testing for Sass.

42 lines (41 loc) 1.38 kB
import { type AtRule as CssAtRule, type Comment as CssComment, type Rule as CssRule } from 'postcss'; export interface TrueOptions { describe: (description: string, fn: () => void) => void; it: (description: string, fn: () => void) => void; sass?: any; sourceType?: 'path' | 'string'; contextLines?: number; } export interface Assertion { description: string; assertionType?: string; output?: string; expected?: string; details?: string; passed?: boolean; [key: string]: boolean | string | undefined; } export interface Test { test: string; assertions: Assertion[]; } export interface Module { module: string; tests?: Test[]; modules?: Module[]; } export type Context = { modules: Module[]; currentModule?: Module; currentTest?: Test; currentAssertion?: Assertion; currentOutputRules?: Rule[]; currentExpectedRules?: Rule[]; currentExpectedStrings?: string[]; currentExpectedContained?: string[]; }; export type Rule = CssComment | CssRule | CssAtRule; export type Parser = (rule: Rule, ctx: Context) => Parser; export declare const runSass: (trueOptions: TrueOptions, src: string, sassOptions?: any) => void; export declare const formatFailureMessage: (assertion: Assertion) => string; export declare const parse: (rawCss: Readonly<string>, ctxLines?: Readonly<number>) => Module[];