Path: blob/main/resolvers/node/test/packageMains.js
829 views
'use strict';12const chai = require('chai');3const expect = chai.expect;4const path = require('path');56const resolver = require('../');78const file = path.join(__dirname, 'package-mains', 'dummy.js');91011describe('packageMains', function () {12it('captures module', function () {13expect(resolver.resolve('./module', file)).property('path')14.to.equal(path.join(__dirname, 'package-mains', 'module', 'src', 'index.js'));15});1617it('captures jsnext', function () {18expect(resolver.resolve('./jsnext', file)).property('path')19.to.equal(path.join(__dirname, 'package-mains', 'jsnext', 'src', 'index.js'));20});2122it('captures module instead of jsnext', function () {23expect(resolver.resolve('./module-and-jsnext', file)).property('path')24.to.equal(path.join(__dirname, 'package-mains', 'module-and-jsnext', 'src', 'index.js'));25});2627it('falls back from a missing "module" to "main"', function () {28expect(resolver.resolve('./module-broken', file)).property('path')29.to.equal(path.join(__dirname, 'package-mains', 'module-broken', 'main.js'));30});31});323334