Commit Graph

115 Commits

Author SHA1 Message Date
Ben Newman
de5411e8fd Allow importing from app node_modules when running test-packages.
Fixes #6827.
2016-05-16 18:21:08 -04:00
Wexpo Lyu
bfdca2aaf9 METEOR_LOCAL_DIR. Fixing #6532
Update History.md
2016-05-02 10:52:20 -07:00
Tom Coleman
ab5ab15768 Rename test-app -> test and test --full-app
Our old "unit" test mode didn't really enforce "unit-ness" and was perfectly capable of running integration test. So it was confusing to call the two modes unit and integration test modes.

Instead, we call them "test mode" and "full app test mode", run with `meteor test` and `meteor test --full-app`.

The rules for test files were also simplified -- simply *.test[s].* for test mode, and *.app-test[s].* for full app tests. `tests/` directories are simply ignored again.
2016-02-29 11:16:54 +11:00
Avital Oliver
a335875e19 Merge remote-tracking branch 'origin/release-1.3' into app-tests 2016-02-05 14:57:44 -08:00
David Greenspan
d6e9921bbb Try to constraint-solve the previousSolution first
To avoid solving the full constraint-solver problem when you start your
app with a previousSolution (i.e. .meteor/versions), we first try to
prove that .meteor/versions is correct as far as we can tell while only
loading the package versions mentioned there.

When it works, it saves both disk I/O and logic-solving time, starting
at a couple seconds and potentially much more.

Everything still works if .meteor/versions is missing, or partially or
totally invalid, or mentions package versions that need to be fetched in
a catalog update first, etc.
2016-02-05 12:13:33 -08:00
David Greenspan
2fca3a9599 Profile more of tool and improvements to Profile
Previously, we would generate reports on
"Selecting Package Versions" and "Rebuild App".

- Instead of just profiling constraint solving, profile the entire
  process of preparing the project via ProjectContext, by giving
  each public function that "advances the stage" a Profile.run
  (typically prepareProjectForBuild).
- Improve profiler output to better distinguish multiple runs
- Distinguish "Build App" and "Rebuild App"
- Instrument lots of calls that weren't instrumented before
2016-02-03 11:54:05 -08:00
Avital Oliver
ac5a4bc809 WIP: Implement a meteor test-app command.
This command builds the app with a different directory for
`.meteor/local`, including built packages and the app database. This
allows running `meteor test-app` and `meteor test` in parallel
for a given app, with DB isolation.

Also, we've changed how test driver packages work (as used for
`meteor test-packages`, like "test-in-browser"). Instead of automatically
running tests when they load, they export a `runTests` function that
you should call when you're ready to run tests.

When running `meteor test-app` or `meteor test-packages` a new additional
last line of code is added that calls `Meteor.startup(...runTests()...)`

TODO:
* Implement `testOnly` packages. The current pattern of reading a global
  from `package.js` won't work for published packages, which are stored
  as metadata, not code.
* Let you choose a test driver package as an argument to `meteor test-app`
* Demonstrate that a Mocha test and driver package are possible to write.
* Expose Meteor.isTest, Meteor.isIntegrationTest, Meteor.isUnitTest
* Implement `meteor test-app --unit` which only loads test files
* `meteor test-app` should load ALL *.tests?.* files, including ones
  inside imports/ directories
2016-01-22 15:18:10 -08:00
Mitar
3a49ae86db Use methods when we have them. 2015-11-24 14:38:48 -08:00
Martijn Walraven
dec5d8ad91 Fix reading cordova-plugins to not remove contents after #
Attempting to remove comments lead to problems adding Cordova plugins
with a Git URL, because the removed part after # contains the SHA.
2015-09-22 22:45:38 +02:00
David Greenspan
92b3d3b1c4 Fix standard-minifiers-package upgrader
`projectConstraintsFile.addConstraints(['foo'])` is wrong because 'foo'
is supposed to be a constraint object, not a string.  However, it would
quietly add a blank line to .meteor/packages!  Now we detect this
mistake, and we also provide addPackages(['foo']).
2015-08-13 14:08:47 -07:00
Slava Kim
afee6b07c7 move catalog/ into packaging/ 2015-08-06 16:39:01 -07:00
Slava Kim
39d8aef3d9 move files into console/ tool-testing/ 2015-08-06 16:39:00 -07:00
Slava Kim
6b1bb038d8 Move files into tools/fs 2015-08-03 22:09:28 -07:00
Slava Kim
8a8db83d29 Move files into tools/utils 2015-08-03 20:32:38 -07:00
Slava Kim
36b542f822 move files into tools/packaging 2015-08-03 16:03:15 -07:00
Slava Kim
5472331fc5 Move isopackets.js to tool-env
Because it is only used in tool to load packages, so it is sort of a
setup environment file.
2015-08-01 14:13:53 -07:00
Slava Kim
49a7088c30 Create a folder "tool-env"
Contains uninteresting setup and cleanup files
2015-07-31 18:38:25 -07:00
Slava Kim
3ddd281d8c Move catalog files into tools/catalog/ 2015-07-30 12:12:07 -07:00
David Glasser
9dbad78d45 meteor lint in a package lints only that package
Also, fix the checks around "did we lint anything": checking
isopack.sourceProcessors.linter just checks to see if that package
itself defines any linter, not if any of the packages it uses has
linters.
2015-07-16 20:43:42 -07:00
David Glasser
2ccaf6a51e Move some files into isobuild subdirectory
The exact borderline between "Isobuild" and "the tool" is a little hazy,
but the idea is that "Isobuild" is the part that you could imagine being
embedded in a non-command-line build tool. It's not about commands or
UI, but just about building packages and apps.

A next step could be moving things that are strictly "the command-line
tool" into their own subdir, and leaving the top directory mostly just
for shared utilities like buildmessage.  (Which could even go in a utils
subdir?)
2015-07-16 15:12:36 -07:00
David Glasser
640ab28544 Improve linting of packages
- Only lint packages when we're actually going to use the output
- The linter adds the files it uses to the corresponding unibuild WatchSets
2015-07-09 16:39:57 -07:00
David Greenspan
ed822326aa Reuse previous Constraint Solver result in tool
If the same ProjectContext calls the PackagesResolver
multiple times and the ConstraintSolver.Input structure
is identical, reuse the same answer.  We still ask the
tool for the catalog data, which currently goes to sqlite
(taking ~70ms in the app tested), but we skip creating a
CS.Solver and a Logic.Solver and running them (~450ms).

Note that if a new ProjectContext is created (not sure when
that happens?), there's no caching across that.
2015-07-06 14:54:08 -07:00
Slava Kim
fa29c70d61 Make a method non-private 2015-06-26 17:35:51 -07:00
Slava Kim
fe9d69a9f7 wip linting packages 2015-06-16 19:51:52 -07:00
David Glasser
2993b298bf give pluginCacheDir to Isopacks
They don't yet give them to plugins though
2015-06-09 11:36:15 -07:00
David Greenspan
0b803b1aa9 Take glasser's suggestions on 4106e8c 2015-04-13 19:51:51 -07:00
David Glasser
a1e002a250 meteor run sees changes to .meteor/versions
`meteor run` doesn't always write changes to `.meteor/versions`: it only
does so if its release (or checkout-ness) matches `.meteor/release`.  So
it preferred to just remember the value of `.meteor/versions` from
rebuild to rebuild rather than forgetting what it knew and re-reading
the possibly-not-updated file.

However, if some other process changes `.meteor/versions`, it would
ignore that change.  With this fix, if `.meteor/versions` changes then
that is considered to be the previous versions list, not the last
version list from the same process.  For example, this would commonly
happen due to using `meteor update` to update packages (without changing
the tool, which would cause the runner to stop).

Fixes #3582.
2015-04-01 14:39:46 -04:00
David Greenspan
4a4680b5d2 Exclude published package from previousSolution
When you `meteor publish` a package (not from an app), a
ProjectContext is created that gets the Version Solver
"previousSolution" from the .versions file in the project directory.
From the point of view of the Version Solver, the package itself is
a root dependency, so if the version changes from last time, you
may be asked to pass --allow-incompatible-update!  That isn't right.
However, the ProjectContext created by `meteor publish` doesn't know
it is created for a particular package.  But it does have the package
marked as "explicitly added."  So for now, the simplest thing to do
is to alter the input to the Version Solver based on the value of
explicitlyAddedLocalPackageDirs.

Oh, another wrinkle here is that we don't actually know the name of
the package we're publishing when we create the PackageContext, so it
can't be an option.

Example of a failing self-test that now passes:
'packages with organizations'
2015-03-30 16:58:47 -07:00
David Greenspan
1b85b8205e Enable detailed profiling of the constraint solver
See the report using METEOR_PROFILE=1
2015-03-13 10:47:52 -07:00
David Greenspan
83dc85478f Add "Select Package Versions" to METEOR_PROFILE
There's no detail yet, but I'm going to add some.  In the mean time,
you just get the total ms for "Selecting Package Versions...", and
if it runs a second time you'll get another report for "(Try 2)"!
2015-03-12 18:12:01 -07:00
David Greenspan
7c245285fe meteor update with no args patches indirect deps
With this change, `meteor update` with no arguments, in addition to
updating direct dependencies, updates patch versions of indirect
dependencies, so you will get your version 1.4.2 in the above example.

Background: As of the new solver, we already prefer patched versions 
when selecting a version for a new indirect dependency.  For example,
if 1.4.0 is the oldest version we could choose, we will take 1.4.1
instead if available.  However, if 1.4.2 came out, there would never
be an occasion to take it, unless you explicitly typed
`meteor update the-indirect-dependency`.  `meteor update` with no
args expands to `meteor update <all direct deps>`.

Also improve comments, tests, and code around CS.Input.
2015-03-12 16:24:05 -07:00
David Greenspan
0e53947a21 Don't refresh on package-version-parser error 2015-03-10 14:34:05 -07:00
David Greenspan
08bc9ab002 Nicer errors when tool encounters bad package name
Verified manually that `meteor update asdf.` displays an error,
not a stack trace.

Include the offending name in all error messages (as we do for
invalid versions).
2015-03-10 13:58:27 -07:00
Mitar
f2dfcfd7e1 Duplicate import. 2015-03-10 13:41:33 -07:00
David Greenspan
6aad026dcf Merge remote-tracking branch 'origin/devel' into use-logic-solver
Conflicts:
	packages/constraint-solver/package.js
	packages/package-version-parser/package.js
2015-03-10 01:43:19 -07:00
David Glasser
63f89e5602 Tell stats server which packages are local
Requires an annoying level of hackery to get the fake-warehouse tests to
pass.

See meteor/package-stats#1.
2015-03-05 13:49:18 -08:00
David Greenspan
f34e06e69c Change name of --breaking
Put in our improved name and usage docs
2015-03-05 11:43:31 -08:00
David Greenspan
c0a9601abf Fix to fix to e5f73a3 2015-02-09 21:54:57 -08:00
David Greenspan
aa645f86a7 Implement --breaking flag
--breaking:
Allow packages in your project to be upgraded or downgraded
to versions that are not semver-compatible with the current
versions, if required to resolve package version conflicts.

Fix behavior so that packages you're updating count too.
2015-02-09 17:12:24 -08:00
David Greenspan
cf4e1bd4e0 Add comment to previousSolution catalog refresh 2015-02-09 12:20:52 -08:00
David Greenspan
e5f73a3636 Potentially address issue 3653
See #3653
2015-02-09 08:29:11 -08:00
David Greenspan
45752e3203 parseConstraint -> parsePackageConstraint
In the return value, `name` has been changed to `package`,
and `vConstraint` is now `versionConstraint`.

`constraint.package` is better than `constraint.name`, where
`constraint` is a PackageConstraint.  It's also more consistent
with functions like parsePackageAtVersion which return an object
like `{package, version}`.

`vConstraint` was too cryptic.

Changes were discussed with Glasser in a code review.

Troposphere does not call parseConstraint or work with constraint
objects, so it doesn't need to change.

This is a breaking change to the package-version-parser API (or one
method of it, at least), but it is considered an internal API so we
are not worrying too much about it.
2015-02-02 13:13:31 -08:00
David Greenspan
e7ee6184a6 Change return value of utils.parsePackageAtVersion
name -> package, as per code review
2015-02-01 12:53:03 -08:00
David Glasser
0e0dfed6a8 Remove "control program" support
This was support code for a now unused system.
2015-01-29 14:03:10 -08:00
David Glasser
3d5e81bf23 Test the right packages with --test-app-path
Usually the project used for test-packages is a brand-new temporary
project. But you can also use --test-app-path, either for performance
reasons (to share the .meteor/local/isopacks cache between executions)
or because Cordova has issues with /tmp.  Previous to this change,
though, test-packages would leave packages in .meteor/packages from a
previous execution, even if they were packages that we are no longer
testing.

Fixes #3446.
2015-01-26 14:57:42 -08:00
Ben Newman
1aba3a8e7a Eliminate the need for getAppDir in tools/server/shell.js.
Summary:
Instead of expecting the child process to figure out where the
`.meteor/local` directory is, we now tell it explicitly via the
`METEOR_SHELL_DIR` environment variable.

Fixes #3437.

Test Plan:
Run `meteor shell` in a separate terminal and see that it still connects
to an app running from the same app directory.

Reviewers: glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D11
2015-01-20 13:56:57 -05:00
David Glasser
f61ada859d Refresh catalog if release's tool has no build
This fixes a corner case where if you synced the catalog between the
creation of a release and the creation of its tool's build for your
platform, running `meteor --release R` would fail.

Fixes #3317.
2015-01-08 12:28:25 -08:00
David Greenspan
e885e78348 Change the format returned by PVP.parseConstraint
This is a breaking change to package-version-parser.

A PackageConstraint used to look like this:

```
{ name: String,
  constraintString: String,
  constraints: [{version: String|null,
                 type: String}]}
```

Now it looks like this:
```
{ name: String,
  constraintString: String,
  vConstraint: {
    raw: String,
    alternatives: [{versionString: String|null,
                    type: String}]}}
```

Where (vConstraint instanceof VersionConstraint) and
(vConstraint.raw === constraintString).

This achieves several desirable changes at once.

* `constraint.constraints` for the disjuncts in “1.0.0||2.0.0”
  was confusing.  `alternatives` is better.
* Having a class for VersionConstraint will come in handy because
  we can add methods to it, and we can use it in the constraint
  solver to represent the problem statement.
* The names “vConstraint” and “versionString” are a little verbose,
  but there really shouldn’t be a lot of code that dives into this
  structure, and I really wanted to avoid anyone ever writing:
  `constraint.constraint.alternatives[0].version`, and then wondering
  what sort of object that was (not a parsed PackageVersion! we could
  parse eagerly but that might be slow).
2015-01-07 20:10:44 -08:00
David Greenspan
ed5fd8e6cf Don’t use parseConstraint for “package@version”
At least, not directly.  When the tool wants to parse a string of the
form “package@version,” it now uses utils.parsePackageAtVersion.

This way, if I make a breaking change to PV.parseConstraint, I only have
to change a few call sites.
2015-01-07 19:04:55 -08:00
David Glasser
253ec1a9d0 Don't add all packages with --get-ready! 2015-01-05 09:51:38 -08:00