Skip to content

Commit

Permalink
move bundler tests to separate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 16, 2022
1 parent aee4010 commit 24f361e
Show file tree
Hide file tree
Showing 23 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"regexp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package bundler
package bundler_tests

import (
"regexp"
"strings"
"testing"

"github.com/evanw/esbuild/internal/bundler"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
Expand Down Expand Up @@ -5779,7 +5780,7 @@ func TestEntryNamesNoSlashAfterDir(t *testing.T) {
"/src/app2/main.ts": `console.log(2)`,
"/src/app3/main.ts": `console.log(3)`,
},
entryPathsAdvanced: []EntryPoint{
entryPathsAdvanced: []bundler.EntryPoint{
{InputPath: "/src/app1/main.ts"},
{InputPath: "/src/app2/main.ts"},
{InputPath: "/src/app3/main.ts", OutputPath: "customPath"},
Expand All @@ -5802,7 +5803,7 @@ func TestEntryNamesNonPortableCharacter(t *testing.T) {
"/entry1-*.ts": `console.log(1)`,
"/entry2-*.ts": `console.log(2)`,
},
entryPathsAdvanced: []EntryPoint{
entryPathsAdvanced: []bundler.EntryPoint{
// The "*" should turn into "_" for cross-platform Windows portability
{InputPath: "/entry1-*.ts"},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package bundler_tests

// This file contains tests for "lowering" syntax, which means converting it to
// older JavaScript. For example, "a ** b" becomes a call to "Math.pow(a, b)"
// when lowered. Which syntax is lowered is determined by the language target.

package bundler

import (
"testing"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

// Bundling test results are stored in snapshot files, located in the
// "snapshots" directory. This allows test results to be updated easily without
Expand All @@ -16,6 +16,7 @@ import (
"sync"
"testing"

"github.com/evanw/esbuild/internal/bundler"
"github.com/evanw/esbuild/internal/cache"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
Expand Down Expand Up @@ -52,7 +53,7 @@ func hasErrors(msgs []logger.Msg) bool {
type bundled struct {
files map[string]string
entryPaths []string
entryPathsAdvanced []EntryPoint
entryPathsAdvanced []bundler.EntryPoint
expectedScanLog string
expectedCompileLog string
options config.Options
Expand Down Expand Up @@ -115,9 +116,9 @@ func (s *suite) __expectBundledImpl(t *testing.T, args bundled, fsKind fs.MockKi
if args.debugLogs {
logKind = logger.DeferLogAll
}
entryPoints := make([]EntryPoint, 0, len(args.entryPaths)+len(args.entryPathsAdvanced))
entryPoints := make([]bundler.EntryPoint, 0, len(args.entryPaths)+len(args.entryPathsAdvanced))
for _, path := range args.entryPaths {
entryPoints = append(entryPoints, EntryPoint{InputPath: path})
entryPoints = append(entryPoints, bundler.EntryPoint{InputPath: path})
}
entryPoints = append(entryPoints, args.entryPathsAdvanced...)

Expand Down Expand Up @@ -156,7 +157,7 @@ func (s *suite) __expectBundledImpl(t *testing.T, args bundled, fsKind fs.MockKi
mockFS := fs.MockFS(args.files, fsKind)
args.options.OmitRuntimeForTests = true
resolver := resolver.NewResolver(mockFS, log, caches, args.options)
bundle := ScanBundle(log, mockFS, resolver, caches, entryPoints, args.options, nil)
bundle := bundler.ScanBundle(log, mockFS, resolver, caches, entryPoints, args.options, nil)
msgs := log.Done()
assertLog(t, msgs, args.expectedScanLog)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bundler
package bundler_tests

import (
"testing"
Expand Down
File renamed without changes.

0 comments on commit 24f361e

Please sign in to comment.