@jscad/dxf-deserializer 2.3.21 → 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,13 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const test = require('ava')
1
+ import fs from 'fs'
2
+ import path from 'path'
4
3
 
5
- const { geometries } = require('@jscad/modeling')
4
+ import test from 'ava'
6
5
 
7
- const { deserialize } = require('../index')
6
+ import { geom2, path2 } from '@jscad/modeling'
8
7
 
9
- const samplesPath = path.dirname(require.resolve('@jscad/sample-files/package.json'))
8
+ import { deserialize } from '../src/index.js'
9
+
10
+ const samplesPath = '../../../node_modules/@jscad/sample-files'
10
11
 
11
12
  //
12
13
  // Test suite for DXF deserialization (import)
@@ -21,7 +22,7 @@ test('ASCII DXF 2D Entities from JSCAD to Object Conversion', (t) => {
21
22
  // expect one layer, containing 1 objects (path2)
22
23
  t.true(Array.isArray(objs))
23
24
  t.is(objs.length, 1)
24
- t.true(geometries.path2.isA(objs[0]))
25
+ t.true(path2.isA(objs[0]))
25
26
  t.true(objs[0].isClosed)
26
27
 
27
28
  dxfPath = path.resolve(samplesPath, 'dxf/jscad/circle10.dxf')
@@ -33,9 +34,9 @@ test('ASCII DXF 2D Entities from JSCAD to Object Conversion', (t) => {
33
34
  // expect one layer, containing 1 objects (path2)
34
35
  t.true(Array.isArray(objs))
35
36
  t.is(objs.length, 1)
36
- t.true(geometries.path2.isA(objs[0]))
37
+ t.true(path2.isA(objs[0]))
37
38
  t.true(objs[0].isClosed)
38
- t.is(geometries.path2.toPoints(objs[0]).length, 32) // path
39
+ t.is(path2.toPoints(objs[0]).length, 32) // path
39
40
  })
40
41
 
41
42
  test('ASCII DXF 2D Lines from Autocad 2017 to Object Conversion', (t) => {
@@ -49,12 +50,12 @@ test('ASCII DXF 2D Lines from Autocad 2017 to Object Conversion', (t) => {
49
50
  t.true(Array.isArray(objs))
50
51
  t.is(objs.length, 23)
51
52
  // NOTE: the extra objects are from the page layout
52
- t.true(geometries.path2.isA(objs[20]))
53
- t.is(geometries.path2.toPoints(objs[20]).length, 2) // line
54
- t.true(geometries.path2.isA(objs[21]))
55
- t.is(geometries.path2.toPoints(objs[21]).length, 2) // line
56
- t.true(geometries.path2.isA(objs[22]))
57
- t.is(geometries.path2.toPoints(objs[22]).length, 2) // line
53
+ t.true(path2.isA(objs[20]))
54
+ t.is(path2.toPoints(objs[20]).length, 2) // line
55
+ t.true(path2.isA(objs[21]))
56
+ t.is(path2.toPoints(objs[21]).length, 2) // line
57
+ t.true(path2.isA(objs[22]))
58
+ t.is(path2.toPoints(objs[22]).length, 2) // line
58
59
  })
59
60
 
60
61
  test('ASCII DXF 2D Circles from Autocad 2017 to Object Conversion', (t) => {
@@ -68,11 +69,11 @@ test('ASCII DXF 2D Circles from Autocad 2017 to Object Conversion', (t) => {
68
69
  t.true(Array.isArray(objs))
69
70
  t.is(objs.length, 23)
70
71
  // NOTE: the extra objects are from the page layout
71
- t.true(geometries.path2.isA(objs[20]))
72
- t.true(geometries.geom2.isA(objs[21]))
73
- t.is(geometries.geom2.toSides(objs[21]).length, 16) // circle
74
- t.true(geometries.geom2.isA(objs[22]))
75
- t.is(geometries.geom2.toSides(objs[22]).length, 16) // circle
72
+ t.true(path2.isA(objs[20]))
73
+ t.true(geom2.isA(objs[21]))
74
+ t.is(geom2.toPoints(objs[21]).length, 16) // circle
75
+ t.true(geom2.isA(objs[22]))
76
+ t.is(geom2.toPoints(objs[22]).length, 16) // circle
76
77
  })
77
78
 
78
79
  test('ASCII DXF 2D Rectangles from Autocad 2017 to Object Conversion', (t) => {
@@ -87,14 +88,14 @@ test('ASCII DXF 2D Rectangles from Autocad 2017 to Object Conversion', (t) => {
87
88
  t.is(objs.length, 23)
88
89
  // NOTE: the extra objects are from the page layout
89
90
  let obj = objs[20]
90
- t.true(geometries.path2.isA(obj))
91
- t.is(geometries.path2.toPoints(obj).length, 4) // rectangle
91
+ t.true(path2.isA(obj))
92
+ t.is(path2.toPoints(obj).length, 4) // rectangle
92
93
  obj = objs[21]
93
- t.true(geometries.path2.isA(obj))
94
- t.is(geometries.path2.toPoints(obj).length, 4) // rectangle
94
+ t.true(path2.isA(obj))
95
+ t.is(path2.toPoints(obj).length, 4) // rectangle
95
96
  obj = objs[22]
96
- t.true(geometries.path2.isA(obj))
97
- t.is(geometries.path2.toPoints(obj).length, 4) // rectangle
97
+ t.true(path2.isA(obj))
98
+ t.is(path2.toPoints(obj).length, 4) // rectangle
98
99
  })
99
100
 
100
101
  test('ASCII DXF 2D Donuts from Autocad 2017 to Object Conversion', (t) => {
@@ -108,12 +109,12 @@ test('ASCII DXF 2D Donuts from Autocad 2017 to Object Conversion', (t) => {
108
109
  t.true(Array.isArray(objs))
109
110
  t.is(objs.length, 23)
110
111
  // NOTE: the extra ojbects are from the page layout
111
- t.true(geometries.path2.isA(objs[20]))
112
- t.is(geometries.path2.toPoints(objs[20]).length, 18) // line
113
- t.true(geometries.path2.isA(objs[21]))
114
- t.is(geometries.path2.toPoints(objs[21]).length, 18) // line
115
- t.true(geometries.path2.isA(objs[22]))
116
- t.is(geometries.path2.toPoints(objs[22]).length, 18) // arc
112
+ t.true(path2.isA(objs[20]))
113
+ t.is(path2.toPoints(objs[20]).length, 18) // line
114
+ t.true(path2.isA(objs[21]))
115
+ t.is(path2.toPoints(objs[21]).length, 18) // line
116
+ t.true(path2.isA(objs[22]))
117
+ t.is(path2.toPoints(objs[22]).length, 18) // arc
117
118
  })
118
119
 
119
120
  test('ASCII DXF 2D Ellipses from Autocad 2017 to Object Conversion', (t) => {
@@ -127,9 +128,9 @@ test('ASCII DXF 2D Ellipses from Autocad 2017 to Object Conversion', (t) => {
127
128
  t.true(Array.isArray(objs))
128
129
  t.is(objs.length, 23)
129
130
  // NOTE: the extra ojbects are from the page layout
130
- t.true(geometries.geom2.isA(objs[20]))
131
- t.true(geometries.geom2.isA(objs[21]))
132
- t.true(geometries.geom2.isA(objs[22]))
131
+ t.true(geom2.isA(objs[20]))
132
+ t.true(geom2.isA(objs[21]))
133
+ t.true(geom2.isA(objs[22]))
133
134
  })
134
135
 
135
136
  test('ASCII DXF 2D Arcs from Autocad 2017 to Object Conversion', (t) => {
@@ -143,9 +144,9 @@ test('ASCII DXF 2D Arcs from Autocad 2017 to Object Conversion', (t) => {
143
144
  t.true(Array.isArray(objs))
144
145
  t.is(objs.length, 23)
145
146
  // NOTE: the extra ojbects are from the page layout
146
- t.true(geometries.path2.isA(objs[20]))
147
- t.true(geometries.path2.isA(objs[21]))
148
- t.true(geometries.path2.isA(objs[22]))
147
+ t.true(path2.isA(objs[20]))
148
+ t.true(path2.isA(objs[21]))
149
+ t.true(path2.isA(objs[22]))
149
150
  })
150
151
 
151
152
  // HATCH as what ?
@@ -1,6 +1,6 @@
1
- const test = require('ava')
1
+ import test from 'ava'
2
2
 
3
- const { deserialize } = require('../index')
3
+ import { deserialize } from '../src/index.js'
4
4
 
5
5
  //
6
6
  // Test suite for DXF deserialization (import)
@@ -10,9 +10,9 @@ test('ASCII DXF 2D Entities translated to JSCAD Scripts', (t) => {
10
10
  const dxf1 = ''
11
11
  const src1 = deserialize({ filename: 'dxf1 test', output: 'script' }, dxf1)
12
12
  const ss1 = src1.split('\n')
13
- t.is(ss1.length, 16)
13
+ t.is(ss1.length, 14)
14
14
  t.true(src1.indexOf('main = ()') > 0)
15
- t.true(src1.indexOf('createPolygon(') > 0)
15
+ t.true(src1.indexOf('createPolygon = (') > 0)
16
16
 
17
17
  // DXF CIRCLE, translates to script with a 'circle' function
18
18
  const dxf2 = `0
@@ -37,10 +37,10 @@ CIRCLE
37
37
  ENDSEC`
38
38
  const src2 = deserialize({ filename: 'dxf2 test', output: 'script' }, dxf2)
39
39
  const ss2 = src2.split('\n')
40
- t.is(ss2.length, 21)
40
+ t.is(ss2.length, 19)
41
41
  t.true(src2.indexOf('main = ()') > 0)
42
42
  t.true(src2.indexOf('circle(') > 0)
43
- t.true(src2.indexOf('colors.colorize(') > 0)
43
+ t.true(src2.indexOf('colorize(') > 0)
44
44
 
45
45
  // DXF LINE, translates to script with a 'line' created from points
46
46
  const dxf3 = `0
@@ -65,7 +65,7 @@ LINE
65
65
  ENDSEC`
66
66
  const src3 = deserialize({ filename: 'dxf3-test', output: 'script' }, dxf3)
67
67
  const ss3 = src3.split('\n')
68
- t.is(ss3.length, 20)
68
+ t.is(ss3.length, 18)
69
69
  t.true(src3.indexOf('main = ()') > 0)
70
70
  t.true(src3.indexOf('line(') > 0)
71
71
 
@@ -102,7 +102,7 @@ AcDbArc
102
102
  ENDSEC`
103
103
  const src4 = deserialize({ filename: 'dxf4-test', output: 'script' }, dxf4)
104
104
  const ss4 = src4.split('\n')
105
- t.is(ss4.length, 20)
105
+ t.is(ss4.length, 18)
106
106
  t.true(src4.indexOf('main = ()') > 0)
107
107
  t.true(src4.indexOf('arc(') > 0)
108
108
 
@@ -139,7 +139,7 @@ LWPOLYLINE
139
139
  ENDSEC`
140
140
  const src5 = deserialize({ filename: 'dxf5-test', output: 'script' }, dxf5)
141
141
  const ss5 = src5.split('\n')
142
- t.is(ss5.length, 25)
142
+ t.is(ss5.length, 23)
143
143
  t.true(src5.indexOf('main = ()') > 0)
144
144
  t.true(src5.indexOf('path2.create(') > 0)
145
145
  t.true(src5.indexOf('path2.appendPoints(') > 0)
@@ -186,13 +186,13 @@ LWPOLYLINE
186
186
  ENDSEC`
187
187
  const src6 = deserialize({ filename: 'dxf6-test', output: 'script' }, dxf6)
188
188
  const ss6 = src6.split('\n')
189
- t.is(ss6.length, 26)
189
+ t.is(ss6.length, 24)
190
190
  t.true(src6.indexOf('main = ()') > 0)
191
191
  t.true(src6.indexOf('path2.create(') > 0)
192
192
  t.true(src6.indexOf('path2.appendPoints(') > 0)
193
193
  t.true(src6.indexOf('path2.appendArc(') > 0)
194
194
  t.true(src6.indexOf('path2.close(') > 0)
195
- t.true(src6.indexOf('fromPoints(') > 0)
195
+ t.true(src6.indexOf('poly3.create(') > 0)
196
196
 
197
197
  // DXF ELLIPSE, translates to script with a 'ellipse' function
198
198
  const dxf7 = `0
@@ -231,7 +231,7 @@ ELLIPSE
231
231
  ENDSEC`
232
232
  const src7 = deserialize({ filename: 'dxf7-test', output: 'script' }, dxf7)
233
233
  const ss7 = src7.split('\n')
234
- t.is(ss7.length, 22)
234
+ t.is(ss7.length, 20)
235
235
  t.true(src7.indexOf('main = ()') > 0)
236
236
  t.true(src7.indexOf('ellipse(') > 0)
237
237
  })
@@ -290,7 +290,7 @@ SEQEND
290
290
  ENDSEC`
291
291
  const src1 = deserialize({ filename: 'dxf1-test', output: 'script' }, dxf1)
292
292
  const ss1 = src1.split('\n')
293
- t.is(ss1.length, 23)
293
+ t.is(ss1.length, 21)
294
294
  t.true(src1.indexOf('path2.create(') > 0)
295
295
  t.true(src1.indexOf('appendPoints(') > 0)
296
296
 
@@ -337,7 +337,7 @@ SEQEND
337
337
  ENDSEC`
338
338
  const src2 = deserialize({ filename: 'dxf2-test', output: 'script' }, dxf2)
339
339
  const ss2 = src2.split('\n')
340
- t.is(ss2.length, 24)
340
+ t.is(ss2.length, 22)
341
341
  t.true(src2.indexOf('path2.create(') > 0)
342
342
  t.true(src2.indexOf('appendPoints(') > 0)
343
343
  t.true(src2.indexOf('appendArc(') > 0)
@@ -389,8 +389,8 @@ SEQEND
389
389
  ENDSEC`
390
390
  const src3 = deserialize({ filename: 'dxf3-test', output: 'script' }, dxf3)
391
391
  const ss3 = src3.split('\n')
392
- t.is(ss3.length, 23)
393
- t.true(src3.indexOf('function layer0(') > 0)
394
- t.true(src3.indexOf('function layer1(') > 0)
392
+ t.is(ss3.length, 21)
393
+ t.true(src3.indexOf('const layer0 = (') > 0)
394
+ t.true(src3.indexOf('const layer1 = (') > 0)
395
395
  t.true(src3.indexOf('circle(') > 0)
396
396
  })
@@ -1,12 +1,12 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const test = require('ava')
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import test from 'ava'
4
4
 
5
- const { geometries } = require('@jscad/modeling')
5
+ import { geom3, path2 } from '@jscad/modeling'
6
6
 
7
- const { deserialize } = require('../index')
7
+ import { deserialize } from '../src/index.js'
8
8
 
9
- const samplesPath = path.dirname(require.resolve('@jscad/sample-files/package.json'))
9
+ const samplesPath = '../../../node_modules/@jscad/sample-files'
10
10
 
11
11
  //
12
12
  // Test suite for DXF deserialization (import)
@@ -21,7 +21,7 @@ test('ASCII DXF from Bourke 3D Entities to Object Conversion', (t) => {
21
21
  // expect one layer, containing 2 objects (geom3 and line3)
22
22
  t.true(Array.isArray(objs))
23
23
  t.is(objs.length, 2)
24
- t.true(geometries.geom3.isA(objs[0]))
24
+ t.true(geom3.isA(objs[0]))
25
25
  // t.true(objs[1] instanceof CSG.Line3D)
26
26
  })
27
27
 
@@ -37,7 +37,7 @@ test('ASCII DXF from JSCAD 3D Shapes to Object Conversion', (t) => {
37
37
  t.true(Array.isArray(objs))
38
38
  t.is(objs.length, 1)
39
39
  let csg = objs[0]
40
- t.true(geometries.geom3.isA(csg))
40
+ t.true(geom3.isA(csg))
41
41
 
42
42
  // instantiate from a simple shape
43
43
  dxfPath = path.resolve(samplesPath, 'dxf/jscad/cube.dxf')
@@ -50,7 +50,7 @@ test('ASCII DXF from JSCAD 3D Shapes to Object Conversion', (t) => {
50
50
  t.true(Array.isArray(objs))
51
51
  t.is(objs.length, 1)
52
52
  csg = objs[0]
53
- t.true(geometries.geom3.isA(csg))
53
+ t.true(geom3.isA(csg))
54
54
 
55
55
  // instantiate from a simple shape
56
56
  dxfPath = path.resolve(samplesPath, 'dxf/jscad/sphere.dxf')
@@ -63,7 +63,7 @@ test('ASCII DXF from JSCAD 3D Shapes to Object Conversion', (t) => {
63
63
  t.true(Array.isArray(objs))
64
64
  t.is(objs.length, 1)
65
65
  csg = objs[0]
66
- t.true(geometries.geom3.isA(csg))
66
+ t.true(geom3.isA(csg))
67
67
 
68
68
  // instantiate from a simple shape
69
69
  dxfPath = path.resolve(samplesPath, 'dxf/jscad/cylinder.dxf')
@@ -76,7 +76,7 @@ test('ASCII DXF from JSCAD 3D Shapes to Object Conversion', (t) => {
76
76
  t.true(Array.isArray(objs))
77
77
  t.is(objs.length, 1)
78
78
  csg = objs[0]
79
- t.true(geometries.geom3.isA(csg))
79
+ t.true(geom3.isA(csg))
80
80
  })
81
81
 
82
82
  test('ASCII DXF from Autocad2017 3D Lines to Object Conversion', (t) => {
@@ -91,11 +91,11 @@ test('ASCII DXF from Autocad2017 3D Lines to Object Conversion', (t) => {
91
91
  t.is(objs.length, 3)
92
92
 
93
93
  let obj = objs[0]
94
- t.true(geometries.path2.isA(obj))
94
+ t.true(path2.isA(obj))
95
95
  obj = objs[1]
96
- t.true(geometries.path2.isA(obj))
96
+ t.true(path2.isA(obj))
97
97
  obj = objs[2]
98
- t.true(geometries.path2.isA(obj)) // FYI the DXF is incorrect
98
+ t.true(path2.isA(obj)) // FYI the DXF is incorrect
99
99
  })
100
100
 
101
101
  test('ASCII DXF from Autocad2017 3D Boxes to Object Conversion', (t) => {
@@ -134,8 +134,8 @@ test('ASCII DXF from exdxf 3D Mesh to Object Conversion', (t) => {
134
134
  t.is(objs.length, 5)
135
135
 
136
136
  const obj4 = objs[4]
137
- t.true(geometries.geom3.isA(obj4))
138
- t.is(geometries.geom3.toPolygons(obj4).length, 6)
137
+ t.true(geom3.isA(obj4))
138
+ t.is(geom3.toPolygons(obj4).length, 6)
139
139
  })
140
140
 
141
141
  test('ASCII DXF from Autocad2017 3D Mesh to Object Conversion', (t) => {
@@ -150,8 +150,8 @@ test('ASCII DXF from Autocad2017 3D Mesh to Object Conversion', (t) => {
150
150
  t.is(objs.length, 2)
151
151
 
152
152
  const obj0 = objs[0]
153
- t.is(geometries.geom3.toPolygons(obj0).length, 54)
153
+ t.is(geom3.toPolygons(obj0).length, 54)
154
154
 
155
155
  const obj1 = objs[1]
156
- t.is(geometries.geom3.toPolygons(obj1).length, 54)
156
+ t.is(geom3.toPolygons(obj1).length, 54)
157
157
  })
@@ -1,8 +1,8 @@
1
- const test = require('ava')
1
+ import test from 'ava'
2
2
 
3
- const countOf = require('../../test/helpers/countOf')
3
+ import { countOf } from '../../test/helpers/countOf.js'
4
4
 
5
- const { deserialize } = require('../index')
5
+ import { deserialize } from '../src/index.js'
6
6
 
7
7
  //
8
8
  // Test suite for DXF deserialization (import)
@@ -216,10 +216,10 @@ SEQEND
216
216
  0
217
217
  ENDSEC`
218
218
  const src3 = deserialize({ filename: 'dxf3-test', output: 'script' }, dxf3)
219
- t.is(countOf('main', src3), 2)
219
+ t.is(countOf('main', src3), 1)
220
220
  t.is(countOf('createPolygon', src3), 11)
221
221
  t.is(countOf('geom3.create', src3), 1)
222
- t.is(countOf('color', src3), 6)
222
+ t.is(countOf('colorize', src3), 1)
223
223
 
224
224
  // DXF 3D POLYLINE with faces, translates to script with 3D geometry
225
225
  })
@@ -293,7 +293,7 @@ ENTITIES
293
293
  ENDSEC`
294
294
  // expect a script which calls createPolygon for each 3DFACE, and creates a new 3D geometry
295
295
  const src1 = deserialize({ filename: 'dxf1-test', output: 'script' }, dxf1)
296
- t.is(countOf('main', src1), 2)
296
+ t.is(countOf('main', src1), 1)
297
297
  t.is(countOf('createPolygon', src1), 3)
298
298
  t.is(countOf('geom3.create', src1), 1)
299
299
  })
@@ -1,10 +1,11 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const test = require('ava')
1
+ import fs from 'fs'
2
+ import path from 'path'
4
3
 
5
- const dxf = require('../DxfReader')
4
+ import test from 'ava'
6
5
 
7
- const samplesPath = path.dirname(require.resolve('@jscad/sample-files/package.json'))
6
+ import { reader } from '../src/DxfReader.js'
7
+
8
+ const samplesPath = '../../../node_modules/@jscad/sample-files'
8
9
 
9
10
  //
10
11
  // Test suite for DXF reader
@@ -14,7 +15,7 @@ test('DXF Reader', (t) => {
14
15
  t.deepEqual(true, fs.existsSync(dxfPath))
15
16
 
16
17
  const src = fs.readFileSync(dxfPath, 'UTF8')
17
- const reader = dxf.reader(src)
18
+ const dxfreader = reader(src)
18
19
 
19
- t.is(typeof reader, 'object')
20
+ t.is(typeof dxfreader, 'object')
20
21
  })
@@ -1,12 +1,13 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const test = require('ava')
1
+ import fs from 'fs'
2
+ import path from 'path'
4
3
 
5
- const { geometries } = require('@jscad/modeling')
4
+ import test from 'ava'
6
5
 
7
- const { deserialize } = require('../index')
6
+ import { path2 } from '@jscad/modeling'
8
7
 
9
- const samplesPath = path.dirname(require.resolve('@jscad/sample-files/package.json'))
8
+ import { deserialize } from '../src/index.js'
9
+
10
+ const samplesPath = '../../../node_modules/@jscad/sample-files'
10
11
 
11
12
  //
12
13
  // Test suite for DXF deserialization (import)
@@ -21,8 +22,8 @@ test('ASCII DXF R13 to Object Conversion', (t) => {
21
22
  t.true(Array.isArray(objs))
22
23
  t.is(objs.length, 16)
23
24
 
24
- t.true(geometries.path2.isA(objs[0]))
25
- t.true(geometries.path2.isA(objs[15]))
25
+ t.true(path2.isA(objs[0]))
26
+ t.true(path2.isA(objs[15]))
26
27
  })
27
28
 
28
29
  test('ASCII DXF R14 to Object Conversion', (t) => {
@@ -46,7 +47,7 @@ test('ASCII DXF ANSI to Object Conversion', (t) => {
46
47
  t.true(Array.isArray(objs))
47
48
  t.is(objs.length, 1)
48
49
 
49
- t.true(geometries.path2.isA(objs[0]))
50
+ t.true(path2.isA(objs[0]))
50
51
  })
51
52
 
52
53
  test('ASCII DXF ISO to Object Conversion', (t) => {
@@ -59,6 +60,6 @@ test('ASCII DXF ISO to Object Conversion', (t) => {
59
60
  t.true(Array.isArray(objs))
60
61
  t.is(objs.length, 14)
61
62
 
62
- t.true(geometries.path2.isA(objs[0]))
63
- t.true(geometries.path2.isA(objs[13]))
63
+ t.true(path2.isA(objs[0]))
64
+ t.true(path2.isA(objs[13]))
64
65
  })
package/tests/test-dxf.js CHANGED
@@ -1,10 +1,11 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const test = require('ava')
1
+ import fs from 'fs'
2
+ import path from 'path'
4
3
 
5
- const { deserialize } = require('../index')
4
+ import test from 'ava'
6
5
 
7
- const samplesPath = path.dirname(require.resolve('@jscad/sample-files/package.json'))
6
+ import { deserialize } from '../src/index.js'
7
+
8
+ const samplesPath = '../../../node_modules/@jscad/sample-files'
8
9
 
9
10
  //
10
11
  // Test suite for DXF deserialization (import)