Skip to content

Commit

Permalink
test: Fix import paths & add type keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Nov 29, 2024
1 parent 39350a9 commit 32b91d1
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ switch (process.env.npm_lifecycle_event) {
'^yaml$': '<rootDir>/dist/index.js',
'^yaml/cli$': '<rootDir>/dist/cli.mjs',
'^yaml/util$': '<rootDir>/dist/util.js',
'^../src/test-events$': '<rootDir>/dist/test-events.js'
'^../src/test-events.ts$': '<rootDir>/dist/test-events.js'
}
transform['[/\\\\]dist[/\\\\].*\\.mjs$'] = babel
break
Expand Down
4 changes: 2 additions & 2 deletions tests/clone.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isAlias, isScalar, parseDocument, Scalar, visit, YAMLMap } from 'yaml'
import { source } from './_utils'
import { isAlias, isScalar, parseDocument, type Scalar, visit, type YAMLMap } from 'yaml'
import { source } from './_utils.ts'

describe('doc.clone()', () => {
test('has expected members', () => {
Expand Down
14 changes: 7 additions & 7 deletions tests/collection-access.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
Document,
parseDocument,
Pair,
Scalar,
YAMLMap,
YAMLOMap,
YAMLSeq,
YAMLSet,
type Scalar,
type YAMLMap,
type YAMLOMap,
type YAMLSeq,
type YAMLSet,
isMap,
isSeq,
isMap
parseDocument
} from 'yaml'

describe('Map', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/cst.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CST, Parser } from 'yaml'
import { source } from './_utils'
import { source } from './_utils.ts'

function cstDoc(src: string) {
const tokens = Array.from(new Parser().parse(src))
Expand Down
4 changes: 2 additions & 2 deletions tests/directives.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parseDocument, Scalar } from 'yaml'
import { source } from './_utils'
import { parseDocument, type Scalar } from 'yaml'
import { source } from './_utils.ts'

describe('%TAG', () => {
test('parse local tags', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/YAML-1.1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { source } from '../_utils'
import { source } from '../_utils.ts'
import { parseAllDocuments } from 'yaml'

test('Use preceding directives if none defined', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/anchors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Alias, Document, parse, parseDocument, YAMLMap, YAMLSeq } from 'yaml'
import { type Alias, Document, parse, parseDocument, type YAMLMap, type YAMLSeq } from 'yaml'

test('basic', () => {
const src = `- &a 1\n- *a\n`
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/comments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { source } from '../_utils'
import { source } from '../_utils.ts'
import * as YAML from 'yaml'

describe('parse comments', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/doc/createNode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Alias, Document, Node, Scalar, YAMLMap, YAMLSeq } from 'yaml'
import { source } from '../_utils'
import { type Alias, Document, type Node, Scalar, YAMLMap, YAMLSeq } from 'yaml'
import { source } from '../_utils.ts'

describe('createNode(value)', () => {
test('boolean', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as YAML from 'yaml'
import { source } from '../_utils'
import { source } from '../_utils.ts'

describe('tabs as indentation', () => {
test('fail on map value indented with tab', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/doc/foldFlowLines.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as YAML from 'yaml'
import { foldFlowLines as fold, FoldOptions } from 'yaml/util'
import { source } from '../_utils'
import { foldFlowLines as fold, type FoldOptions } from 'yaml/util'
import { source } from '../_utils.ts'

const FOLD_FLOW = 'flow'
const FOLD_QUOTED = 'quoted'
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/parse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFileSync } from 'fs'
import { resolve } from 'path'
import * as YAML from 'yaml'
import { source } from '../_utils'
import { source } from '../_utils.ts'

describe('scalars', () => {
test('empty block scalar at end of document', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/doc/stringify.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { source } from '../_utils'
import { source } from '../_utils.ts'
import * as YAML from 'yaml'
import { Pair, Scalar } from 'yaml'

Expand Down
18 changes: 9 additions & 9 deletions tests/doc/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {
CollectionTag,
type CollectionTag,
Document,
DocumentOptions,
Node,
parse,
ParsedNode,
type DocumentOptions,
type Node,
parseDocument as origParseDocument,
ParseOptions,
parse,
type ParsedNode,
type ParseOptions,
Scalar,
ScalarTag,
type ScalarTag,
Schema,
SchemaOptions,
type SchemaOptions,
stringify,
YAMLMap,
YAMLSeq
} from 'yaml'
import { seqTag, stringifyString, stringTag } from 'yaml/util'
import { source } from '../_utils'
import { source } from '../_utils.ts'

const parseDocument = <T extends Node = ParsedNode>(
source: string,
Expand Down
4 changes: 2 additions & 2 deletions tests/node-to-js.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parseDocument, YAMLMap, YAMLSeq } from 'yaml'
import { source } from './_utils'
import { parseDocument, type YAMLMap, type YAMLSeq } from 'yaml'
import { source } from './_utils.ts'

describe('scalars', () => {
test('plain', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/stream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Composer, Document, Parser, parseDocument } from 'yaml'
import { Composer, type Document, Parser, parseDocument } from 'yaml'

const src = `
#c0\n \n
Expand Down
2 changes: 1 addition & 1 deletion tests/visit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Document, isSeq, parseDocument, Scalar, visit, visitAsync } from 'yaml'
import { Document, isSeq, parseDocument, type Scalar, visit, visitAsync } from 'yaml'

const coll = { items: {} }

Expand Down
4 changes: 2 additions & 2 deletions tests/yaml-test-suite.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { readdirSync, readFileSync } from 'fs'
import { resolve } from 'path'

import { CST, Document, Lexer, parse, parseAllDocuments, Parser } from 'yaml'
import { testEvents } from '../src/test-events' // no public export
import { CST, type Document, Lexer, parse, parseAllDocuments, Parser } from 'yaml'
import { testEvents } from '../src/test-events.ts' // no public export

type TestCase = {
yaml: string
Expand Down

0 comments on commit 32b91d1

Please sign in to comment.